Sample Input
2
10 3
2 6 7
214 7
11 12 7 13 176 23 191
Sample Output
4 8
38 207
蚂蚁相遇后沿原路返回,但是如果不考虑蚂蚁之间的差别,其实完全可以想成是擦肩而过,这样想问题就很简单了。
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 1e6+10;
int nums[N];
int len = 0,n = 0;