10552 | 2024-04-05 12:36:12 | CWM | Xorzótábla | cpp17 | Wrong answer 14/100 | 996ms | 7516 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;
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 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 | 1832 KiB | ||||
2 | Wrong answer | 832ms | 4796 KiB | ||||
subtask2 | 14/14 | ||||||
3 | Accepted | 3ms | 2380 KiB | ||||
4 | Accepted | 4ms | 2464 KiB | ||||
5 | Accepted | 4ms | 2544 KiB | ||||
6 | Accepted | 4ms | 2672 KiB | ||||
7 | Accepted | 8ms | 2760 KiB | ||||
8 | Accepted | 8ms | 2888 KiB | ||||
9 | Accepted | 10ms | 2872 KiB | ||||
subtask3 | 0/14 | ||||||
10 | Accepted | 3ms | 2912 KiB | ||||
11 | Accepted | 902ms | 6244 KiB | ||||
12 | Wrong answer | 896ms | 6212 KiB | ||||
13 | Wrong answer | 995ms | 6640 KiB | ||||
14 | Wrong answer | 995ms | 6676 KiB | ||||
subtask4 | 0/14 | ||||||
15 | Accepted | 469ms | 5932 KiB | ||||
16 | Wrong answer | 632ms | 6544 KiB | ||||
17 | Wrong answer | 648ms | 6700 KiB | ||||
18 | Accepted | 721ms | 6972 KiB | ||||
19 | Accepted | 720ms | 7176 KiB | ||||
subtask5 | 0/21 | ||||||
20 | Accepted | 100ms | 4792 KiB | ||||
21 | Accepted | 352ms | 5912 KiB | ||||
22 | Wrong answer | 535ms | 6352 KiB | ||||
23 | Wrong answer | 606ms | 6904 KiB | ||||
24 | Accepted | 648ms | 6980 KiB | ||||
25 | Accepted | 444ms | 7068 KiB | ||||
subtask6 | 0/37 | ||||||
26 | Accepted | 71ms | 4572 KiB | ||||
27 | Accepted | 451ms | 6276 KiB | ||||
28 | Wrong answer | 787ms | 6804 KiB | ||||
29 | Wrong answer | 699ms | 6936 KiB | ||||
30 | Accepted | 996ms | 7516 KiB | ||||
31 | Accepted | 995ms | 7512 KiB | ||||
32 | Accepted | 453ms | 7512 KiB | ||||
33 | Accepted | 986ms | 7516 KiB | ||||
34 | Wrong answer | 986ms | 7412 KiB |