105402024-04-04 18:45:13CWMXorzótáblacpp17Time limit exceeded 0/1002.099s6672 KiB
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <climits>

using namespace std;
long long cMod = 2;
int bitlookahead = 1;

bool comp(int a, int b) {
    a = a % cMod;
    b = b % cMod;
    return b > a;
}

signed main()
{
    int sA, sB;
    cin >> sA >> sB;
    vector<int> a(sA);
    vector<int> b(sB);
    for (size_t i = 0; i < sA; i++)
    {
        cin >> a[i];
    }
    for (size_t i = 0; i < sB; i++)
    {
        cin >> b[i];
    }
    int res = 0;
    while (cMod<4e9)
    {
        sort(a.begin(), a.end(), comp);
        sort(b.begin(), b.end(), comp);
        vector<int> aTemp(sA);
        vector<int> bTemp(sB);
        for (size_t i = 0; i < sA; i++)
        {
            aTemp[i] = a[i] % cMod;
        }
        for (size_t i = 0; i < sB; i++)
        {
            bTemp[i] = b[i] % cMod;
        }
        int lLim = cMod / 2;
        int uLim = cMod;
        int ans = 0;
        for (size_t i = 0; i < aTemp.size(); i++)
        {
            int lIdx = lower_bound(bTemp.begin(), bTemp.end(), lLim - aTemp[i]) - bTemp.begin();
            int uIdx = lower_bound(bTemp.begin(), bTemp.end(), uLim - aTemp[i]) - bTemp.begin();
            int cDif = uIdx - lIdx;
            ans += cDif;
        }
        if (ans % 2 == 1) {
            res += cMod;
        }
        cMod *= 2;
        bitlookahead++;
    }
    cout << res/2;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1808 KiB
2Time limit exceeded2.099s2772 KiB
subtask20/14
3Wrong answer3ms2292 KiB
4Wrong answer14ms2540 KiB
5Wrong answer14ms2700 KiB
6Wrong answer8ms2908 KiB
7Wrong answer21ms3160 KiB
8Wrong answer21ms3324 KiB
9Wrong answer28ms3536 KiB
subtask30/14
10Wrong answer4ms3716 KiB
11Time limit exceeded2.099s4592 KiB
12Time limit exceeded2.069s4524 KiB
13Time limit exceeded2.059s4820 KiB
14Time limit exceeded2.046s5184 KiB
subtask40/14
15Time limit exceeded2.065s4864 KiB
16Time limit exceeded2.055s4968 KiB
17Time limit exceeded2.073s5048 KiB
18Time limit exceeded2.051s5308 KiB
19Time limit exceeded2.013s5468 KiB
subtask50/21
20Wrong answer497ms5272 KiB
21Wrong answer1.794s6672 KiB
22Time limit exceeded2.059s5308 KiB
23Time limit exceeded2.069s5856 KiB
24Time limit exceeded2.078s5956 KiB
25Time limit exceeded2.078s6000 KiB
subtask60/37
26Wrong answer259ms5212 KiB
27Time limit exceeded2.058s5200 KiB
28Time limit exceeded2.075s5384 KiB
29Time limit exceeded2.053s5492 KiB
30Time limit exceeded2.049s6072 KiB
31Time limit exceeded2.066s6016 KiB
32Time limit exceeded2.033s6024 KiB
33Time limit exceeded2.078s6096 KiB
34Time limit exceeded2.073s6060 KiB