#include <bits/stdc++.h>
#include "transfer.h"
using namespace std;
vector<int> get_attachment(vector<int> source)
{
int N = source.size(), lst = 0;
vector<int> ret;
for (int i = 0; i < __lg(N + 1); i++)
{
int t = 0;
for (int j = 0; j < N; j++)
if ((j + 1) & (1 << i))
t ^= source[j];
ret.push_back(t);
lst ^= t;
}
ret.push_back(lst);
return ret;
}
vector<int> retrieve(vector<int> data)
{
int N = (data.size() == 70 ? 63 : 255), K = data.size() - N;
vector<int> ret;
for (int i = 0; i < N; i++)
ret.push_back(data[i]);
int arr[6] = {};
for (int i = 0; i < __lg(N + 1); i++)
for (int j = 0; j < N; j++)
if ((j + 1) & (1 << i))
arr[i] ^= data[j];
int inc = 0;
for (int i = 0; i < __lg(N + 1); i++)
inc += (1 << i) * (arr[i] != data[N + i]);
int t = 0;
for (int i = N; i < N + K - 1; i++)
t ^= data[i];
if (inc && t == data[N + K - 1])
ret[inc - 1] = !ret[inc - 1];
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1152 KB |
Output is correct |
2 |
Correct |
8 ms |
908 KB |
Output is correct |
3 |
Correct |
8 ms |
1036 KB |
Output is correct |
4 |
Correct |
8 ms |
908 KB |
Output is correct |
5 |
Correct |
8 ms |
1148 KB |
Output is correct |
6 |
Correct |
8 ms |
1036 KB |
Output is correct |
7 |
Correct |
9 ms |
1036 KB |
Output is correct |
8 |
Correct |
9 ms |
908 KB |
Output is correct |
9 |
Correct |
9 ms |
908 KB |
Output is correct |
10 |
Correct |
8 ms |
908 KB |
Output is correct |
11 |
Correct |
8 ms |
1148 KB |
Output is correct |
12 |
Correct |
8 ms |
908 KB |
Output is correct |
13 |
Correct |
9 ms |
908 KB |
Output is correct |
14 |
Correct |
8 ms |
1036 KB |
Output is correct |
15 |
Correct |
8 ms |
908 KB |
Output is correct |
16 |
Correct |
8 ms |
1036 KB |
Output is correct |
17 |
Correct |
8 ms |
908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
3304 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |