10555 | 2024-04-05 13:09:37 | CWM | Xorzótábla | cpp17 | Accepted 100/100 | 996ms | 7164 KiB |
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;
long long cMod = 2;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
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];
}
long long res = 0;
while (cMod<4e9)
{
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;
}
sort(aTemp.begin(), aTemp.end());
sort(bTemp.begin(), bTemp.end());
long long lLim = cMod / 2;
long long uLim = cMod;
long long 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 ulIdx = lower_bound(bTemp.begin(), bTemp.end(), uLim+lLim - aTemp[i]) - bTemp.begin();
int cDif = uIdx - lIdx + bTemp.size()-ulIdx;
ans += cDif;
}
if (ans % 2 == 1) {
res += cMod;
}
cMod *= 2;
}
cout << res/2;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1696 KiB | ||||
2 | Accepted | 833ms | 4680 KiB | ||||
subtask2 | 14/14 | ||||||
3 | Accepted | 3ms | 1944 KiB | ||||
4 | Accepted | 4ms | 2188 KiB | ||||
5 | Accepted | 4ms | 2300 KiB | ||||
6 | Accepted | 4ms | 2512 KiB | ||||
7 | Accepted | 8ms | 2600 KiB | ||||
8 | Accepted | 8ms | 2732 KiB | ||||
9 | Accepted | 10ms | 2932 KiB | ||||
subtask3 | 14/14 | ||||||
10 | Accepted | 3ms | 3004 KiB | ||||
11 | Accepted | 902ms | 6300 KiB | ||||
12 | Accepted | 896ms | 6052 KiB | ||||
13 | Accepted | 996ms | 6504 KiB | ||||
14 | Accepted | 996ms | 6540 KiB | ||||
subtask4 | 14/14 | ||||||
15 | Accepted | 467ms | 5824 KiB | ||||
16 | Accepted | 633ms | 6288 KiB | ||||
17 | Accepted | 648ms | 6272 KiB | ||||
18 | Accepted | 721ms | 6508 KiB | ||||
19 | Accepted | 721ms | 6764 KiB | ||||
subtask5 | 21/21 | ||||||
20 | Accepted | 101ms | 4696 KiB | ||||
21 | Accepted | 354ms | 6000 KiB | ||||
22 | Accepted | 535ms | 6344 KiB | ||||
23 | Accepted | 607ms | 6828 KiB | ||||
24 | Accepted | 649ms | 6792 KiB | ||||
25 | Accepted | 446ms | 6776 KiB | ||||
subtask6 | 37/37 | ||||||
26 | Accepted | 71ms | 4024 KiB | ||||
27 | Accepted | 451ms | 5492 KiB | ||||
28 | Accepted | 787ms | 6096 KiB | ||||
29 | Accepted | 700ms | 6188 KiB | ||||
30 | Accepted | 996ms | 7164 KiB | ||||
31 | Accepted | 995ms | 7116 KiB | ||||
32 | Accepted | 455ms | 7060 KiB | ||||
33 | Accepted | 987ms | 6992 KiB | ||||
34 | Accepted | 989ms | 7048 KiB |