#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int x = 0;
int n = source.size();
for(int i = 1; i <= n; i++){
if(source[i - 1]) x ^= i;
}
vector<int> v;
int l = 0;
if(n == 63) l = 6;
else l = 8;
int xx = 0;
for(int i = 0; i < l; i++){
v.push_back(bool(x & (1 << i)));
xx ^= v[i];
}
v.push_back(xx);
return v;
}
vector<int> retrieve(vector<int> data) {
int n, l;
if(data.size() == 63 + 6 + 1) n = 63, l = 6;
else n = 255, l = 8;
int x = 0;
for(int i = 1; i <= n; i++){
if(data[i - 1]) x ^= i;
}
int x1 = 0;
int bitx = 0;
for(int i = 0; i < l; i++){
if(data[n + i]){
x1 |= (1 << i);
bitx ^= 1;
}
}
if(bitx == data[n + l]){
if(x != x1) data[(x ^ x1) - 1] ^= 1;
}
vector<int> v;
for(int i = 0; i < n; i++) v.push_back(data[i]);
return v;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
788 KB |
Output is correct |
2 |
Correct |
1 ms |
996 KB |
Output is correct |
3 |
Correct |
1 ms |
788 KB |
Output is correct |
4 |
Correct |
1 ms |
996 KB |
Output is correct |
5 |
Correct |
1 ms |
860 KB |
Output is correct |
6 |
Correct |
2 ms |
788 KB |
Output is correct |
7 |
Correct |
1 ms |
828 KB |
Output is correct |
8 |
Correct |
3 ms |
788 KB |
Output is correct |
9 |
Correct |
1 ms |
788 KB |
Output is correct |
10 |
Correct |
1 ms |
796 KB |
Output is correct |
11 |
Correct |
1 ms |
1000 KB |
Output is correct |
12 |
Correct |
1 ms |
796 KB |
Output is correct |
13 |
Correct |
2 ms |
784 KB |
Output is correct |
14 |
Correct |
2 ms |
796 KB |
Output is correct |
15 |
Correct |
1 ms |
788 KB |
Output is correct |
16 |
Correct |
1 ms |
1008 KB |
Output is correct |
17 |
Correct |
2 ms |
784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
2508 KB |
Output is correct |
2 |
Correct |
48 ms |
2512 KB |
Output is correct |
3 |
Correct |
51 ms |
2504 KB |
Output is correct |
4 |
Correct |
46 ms |
2508 KB |
Output is correct |
5 |
Correct |
46 ms |
2504 KB |
Output is correct |
6 |
Correct |
47 ms |
2508 KB |
Output is correct |
7 |
Correct |
46 ms |
2504 KB |
Output is correct |
8 |
Correct |
42 ms |
2508 KB |
Output is correct |
9 |
Correct |
47 ms |
2504 KB |
Output is correct |
10 |
Correct |
39 ms |
2500 KB |
Output is correct |
11 |
Correct |
43 ms |
2512 KB |
Output is correct |
12 |
Correct |
50 ms |
2504 KB |
Output is correct |
13 |
Correct |
46 ms |
2512 KB |
Output is correct |
14 |
Correct |
46 ms |
2500 KB |
Output is correct |
15 |
Correct |
50 ms |
2520 KB |
Output is correct |
16 |
Correct |
45 ms |
2508 KB |
Output is correct |
17 |
Correct |
47 ms |
2504 KB |
Output is correct |
18 |
Correct |
62 ms |
2516 KB |
Output is correct |
19 |
Correct |
46 ms |
2504 KB |
Output is correct |