蒟蒻实在调不通代码了。往大佬指点指点。
样例能过,但代码上来就给我拉了坨大的:一个点没过!
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
unsigned long long a[5000005] = {}, b[5000005] = {};
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while (T --) {
int n, m, t;
unsigned long long res = 0;
cin >> n >> m;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
}
for (int i = 1; i <= m; i ++) {
cin >> b[i];
}
for (int i = 1, j = 1; i <= n && j <= m; i ++) {
t = j;
while (a[i] == b[j] && j <= m) {
j ++;
}
res ^= j - t;
}
cout << res << '\n';
}
return 0;
}