QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#461990 | #8520. Xor Partitions | hhc0716 | WA | 1ms | 5712kb | C++14 | 1.1kb | 2024-07-03 11:46:27 | 2024-07-03 11:46:27 |
Judging History
answer
#include <bits/stdc++.h>
//#define TEST 1
//#ifdef ONLINE_JUDGE
//#undef TEST // This will not be compiled
//#endif
#define int long long
using namespace std;
const int kMod = (int)(1e9) + 7;
int n, arr[300030], f[300030], s[110], t[110], cs;
signed main() {
//f[0] = 1;
for(int i = 63; i >= 0; i--) {
s[i] = 1;
}
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> arr[i];
cs ^= arr[i];
for(int j = 63; j >= 0; j--) {
if((cs >> j) & 1) {
swap(s[j], t[j]);
}
f[i] = (f[i] + (1 << j) % kMod * t[j] % kMod) % kMod;
if((cs >> j) & 1) {
swap(s[j], t[j]);
}
}
for(int j = 63; j >= 0; j--) {
if((cs >> j) & 1) {
t[j] = (t[j] + f[i]) % kMod;
}else {
s[j] = (s[j] + f[i]) % kMod;
}
//cout << s[j] << ' ' << t[j] << '\n';
}
#ifdef TEST
//cout << f[i] << '\n';
#endif
}
#ifndef TEST
cout << f[n] << '\n';
#endif
#ifdef TEST
//cout << '\n';
#endif
return 0;
}
/*
1
1000000000000000000
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5620kb
input:
4 7 3 1 2
output:
170
result:
ok 1 number(s): "170"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5532kb
input:
1 0
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5532kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5572kb
input:
3 1 2 3
output:
16
result:
ok 1 number(s): "16"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
4 0 1 0 1
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 5576kb
input:
562 918479109239293921 960173570446350728 374394588863436385 418106819278123099 473761712658352147 662782574081105364 824954323015093862 827581845536521847 184394794881199801 820907621998888642 606529830885621237 961790689782125501 582742201855597942 337901250755571075 287706594894797714 18578215893...
output:
910272497
result:
wrong answer 1st numbers differ - expected: '641941658', found: '910272497'