#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int K = 9;
if (source.size() == 63) {
K = 8;
}
int n = source.size();
vector<int> ret(K);
for (int i = 0; i < n; i++) {
for (int j = 0; j < K - 1; j++) {
if ((i + 1) >> j & 1) {
ret[j] ^= source[i];
}
}
ret[K - 1] ^= source[i];
}
return ret;
}
vector<int> retrieve(vector<int> data) {
int K = 9;
if (data.size() < 255) {
K = 8;
}
int n = data.size();
int f = 0;
for (int i = 0; i < n - K; i++) {
f ^= data[i];
}
vector<int> ans(n - K);
for (int i = 0; i < n - K; i++) {
ans[i] = data[i];
}
if (f == data.back()) {
return ans;
}
vector<int> r(8);
for (int i = 0; i < n - K; i++) {
for (int j = 0; j < K - 1; j++) {
if ((i + 1) >> j & 1) {
r[j] ^= data[i];
}
}
}
int pos = 0;
for (int i = 0; i < K - 1; i++) {
if (r[i] != data[n - K + i]) {
pos += (1 << i);
}
}
if (pos != 0) {
pos--;
ans[pos] ^= 1;
}
return ans;
}
/*
5
0 011001010110110110100111110011010111111111111000101011100101001
7 011001010110110110100111110011010111111111111000101011100101001
62 011001010110110110100111110011010111111111111000101011100101001
63 011001010110110110100111110011010111111111111000101011100101001
-1 011001010110110110100111110011010111111111111000101011100101001
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
5 ms |
648 KB |
Partially correct |
2 |
Partially correct |
6 ms |
644 KB |
Partially correct |
3 |
Partially correct |
5 ms |
652 KB |
Partially correct |
4 |
Partially correct |
5 ms |
644 KB |
Partially correct |
5 |
Partially correct |
5 ms |
652 KB |
Partially correct |
6 |
Partially correct |
5 ms |
652 KB |
Partially correct |
7 |
Partially correct |
5 ms |
652 KB |
Partially correct |
8 |
Partially correct |
5 ms |
640 KB |
Partially correct |
9 |
Partially correct |
5 ms |
724 KB |
Partially correct |
10 |
Partially correct |
5 ms |
652 KB |
Partially correct |
11 |
Partially correct |
5 ms |
644 KB |
Partially correct |
12 |
Partially correct |
6 ms |
644 KB |
Partially correct |
13 |
Partially correct |
5 ms |
644 KB |
Partially correct |
14 |
Partially correct |
5 ms |
644 KB |
Partially correct |
15 |
Partially correct |
5 ms |
644 KB |
Partially correct |
16 |
Partially correct |
5 ms |
644 KB |
Partially correct |
17 |
Partially correct |
5 ms |
644 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
282 ms |
2492 KB |
Output is correct |
2 |
Correct |
299 ms |
2484 KB |
Output is correct |
3 |
Correct |
283 ms |
2492 KB |
Output is correct |
4 |
Correct |
278 ms |
2492 KB |
Output is correct |
5 |
Correct |
290 ms |
2492 KB |
Output is correct |
6 |
Correct |
282 ms |
2492 KB |
Output is correct |
7 |
Correct |
299 ms |
2492 KB |
Output is correct |
8 |
Correct |
274 ms |
2492 KB |
Output is correct |
9 |
Correct |
283 ms |
2492 KB |
Output is correct |
10 |
Correct |
289 ms |
2492 KB |
Output is correct |
11 |
Correct |
269 ms |
2488 KB |
Output is correct |
12 |
Correct |
289 ms |
2484 KB |
Output is correct |
13 |
Correct |
272 ms |
2492 KB |
Output is correct |
14 |
Correct |
294 ms |
2484 KB |
Output is correct |
15 |
Correct |
282 ms |
2460 KB |
Output is correct |
16 |
Correct |
272 ms |
2484 KB |
Output is correct |
17 |
Correct |
289 ms |
2484 KB |
Output is correct |
18 |
Correct |
268 ms |
2492 KB |
Output is correct |
19 |
Correct |
297 ms |
2484 KB |
Output is correct |