55542023-07-25 12:45:08szilXorzótáblacpp17Accepted 100/1001.218s11036 KiB
#include <bits/stdc++.h>
#define int long long

using ll = long long;
using namespace std;

const int MAXN = 100010;

int a[MAXN], b[MAXN], p[MAXN], q[MAXN];

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m; cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) cin >> b[i];
    int ans = 0;
    for (int k = 0; k < 31; k++) {
        int x = 1LL<<k, y = 1LL<<(k+1);
        for (int j = 1; j <= n; j++) {
            p[j] = a[j] % y;
        }
        for (int j = 1; j <= m; j++) {
            q[j] = b[j] % y;
        }
        sort(q+1, q+m+1);
        ll cnt = 0;
        for (int j = 1; j <= n; j++) {
            {
                int left = lower_bound(q+1, q+m+1, x-p[j])-q;
                int right = lower_bound(q+1, q+m+1, y-p[j])-q;
                cnt += right-left;
            }
            {
                int left = lower_bound(q+1, q+m+1, (x+y)-p[j])-q;
                cnt += m-left+1;
            }
        }
        if (cnt&1)
            ans |= 1 << k;
    }
    cout << ans << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1948 KiB
2Accepted994ms7492 KiB
subtask214/14
3Accepted3ms2504 KiB
4Accepted4ms2736 KiB
5Accepted4ms2948 KiB
6Accepted4ms3132 KiB
7Accepted8ms3104 KiB
8Accepted7ms3424 KiB
9Accepted9ms3672 KiB
subtask314/14
10Accepted3ms3336 KiB
11Accepted954ms9772 KiB
12Accepted1.085s9376 KiB
13Accepted1.218s9932 KiB
14Accepted1.215s10216 KiB
subtask414/14
15Accepted409ms8640 KiB
16Accepted509ms9664 KiB
17Accepted456ms9420 KiB
18Accepted546ms10344 KiB
19Accepted533ms10484 KiB
subtask521/21
20Accepted82ms5396 KiB
21Accepted307ms8420 KiB
22Accepted414ms9568 KiB
23Accepted493ms10568 KiB
24Accepted523ms11036 KiB
25Accepted395ms10712 KiB
subtask637/37
26Accepted59ms5064 KiB
27Accepted474ms8304 KiB
28Accepted994ms9292 KiB
29Accepted810ms9332 KiB
30Accepted1.218s10804 KiB
31Accepted1.218s10848 KiB
32Accepted360ms10816 KiB
33Accepted1.194s10784 KiB
34Accepted1.197s10812 KiB