#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
#define siz(x) (int)x.size()
vi get_attachment(vi v){
int xr = 0, on = 0;
for (int i = 0; i < siz(v); i++) xr ^= (i+1)*v[i];
vi res;
for (int i = 0; i < __lg(siz(v)+1); i++){
res.push_back(xr&(1<<i)?1:0);
if (xr&(1<<i)) on ^= 1;
}
res.push_back(on);
return res;
}
vi retrieve(vi v){
int n = (siz(v) < 100? 63 : 255), xr = 0, check = 0;
vi res;
for (int i = 0; i < n; i++){
xr ^= (i+1)*v[i];
res.push_back(v[i]);
}
for (int i = 0; i < __lg(n+1); i++) if (v[n+i]) check ^= (1<<i);
if (xr != check && __builtin_popcount(check)%2 == v.back()) res[(xr^check)-1] ^= 1;
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
644 KB |
Output is correct |
2 |
Correct |
4 ms |
664 KB |
Output is correct |
3 |
Correct |
3 ms |
644 KB |
Output is correct |
4 |
Correct |
4 ms |
644 KB |
Output is correct |
5 |
Correct |
3 ms |
644 KB |
Output is correct |
6 |
Correct |
4 ms |
812 KB |
Output is correct |
7 |
Correct |
4 ms |
652 KB |
Output is correct |
8 |
Correct |
4 ms |
652 KB |
Output is correct |
9 |
Correct |
3 ms |
652 KB |
Output is correct |
10 |
Correct |
4 ms |
728 KB |
Output is correct |
11 |
Correct |
4 ms |
644 KB |
Output is correct |
12 |
Correct |
4 ms |
652 KB |
Output is correct |
13 |
Correct |
4 ms |
644 KB |
Output is correct |
14 |
Correct |
3 ms |
648 KB |
Output is correct |
15 |
Correct |
4 ms |
652 KB |
Output is correct |
16 |
Correct |
4 ms |
652 KB |
Output is correct |
17 |
Correct |
4 ms |
644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
2488 KB |
Output is correct |
2 |
Correct |
95 ms |
2488 KB |
Output is correct |
3 |
Correct |
98 ms |
2496 KB |
Output is correct |
4 |
Correct |
94 ms |
2488 KB |
Output is correct |
5 |
Correct |
93 ms |
2496 KB |
Output is correct |
6 |
Correct |
102 ms |
2488 KB |
Output is correct |
7 |
Correct |
94 ms |
2488 KB |
Output is correct |
8 |
Correct |
94 ms |
2432 KB |
Output is correct |
9 |
Correct |
99 ms |
2496 KB |
Output is correct |
10 |
Correct |
96 ms |
2488 KB |
Output is correct |
11 |
Correct |
96 ms |
2500 KB |
Output is correct |
12 |
Correct |
95 ms |
2488 KB |
Output is correct |
13 |
Correct |
95 ms |
2488 KB |
Output is correct |
14 |
Correct |
100 ms |
2496 KB |
Output is correct |
15 |
Correct |
100 ms |
2488 KB |
Output is correct |
16 |
Correct |
95 ms |
2496 KB |
Output is correct |
17 |
Correct |
94 ms |
2496 KB |
Output is correct |
18 |
Correct |
96 ms |
2496 KB |
Output is correct |
19 |
Correct |
95 ms |
2492 KB |
Output is correct |