#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mod = 1e9 + 7;
const int N = 1e6 + 15;
const ll inf = 1e18;
#include "transfer.h"
vector<int> get_attachment(vector<int> source) {
int n = sz(source);
int B;
if (n<=63){
B = 7;
}
else B = 9;
vector<int> a(B);
for (int i=1;i<=n;i++){
for (int b=0;b<B-1;b++){
if ((i>>b)&1) a[b] ^= source[i-1];
}
}
for (int i=0;i<B-1;i++){
a[B-1] ^= a[i];
}
return a;
}
vector<int> retrieve(vector<int> data) {
int n = sz(data);
int B;
if (n<=63+7){
B = 7;
}
else B = 9;
n -= B;
int ans = 0;
bool ok = 1;
int cur = 0;
for (int i=n;i<n+B-1;i++){
cur ^= data[i];
}
ok &= data.back()==cur;
vector<int> c(B-1);
for (int i=1;i<=n;i++){
for (int b=0;b<B-1;b++){
if ((i>>b)&1) c[b] ^= data[i-1];
}
}
for (int i=n;i<n+B-1;i++){
if (data[i] != c[i-n]) ans |= (1<<(i-n));
}
vector<int> fin_ans(n);
if (ans==0 or !ok){
for (int i=0;i<n;i++){
fin_ans[i] = data[i];
}
}
else {
for (int i=0;i<n;i++){
if (ans==i+1) fin_ans[i] = 1^data[i];
else fin_ans[i] = data[i];
}
}
return fin_ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
648 KB |
Output is correct |
2 |
Correct |
6 ms |
664 KB |
Output is correct |
3 |
Correct |
4 ms |
652 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
4 ms |
828 KB |
Output is correct |
6 |
Correct |
4 ms |
644 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
6 ms |
668 KB |
Output is correct |
9 |
Correct |
4 ms |
644 KB |
Output is correct |
10 |
Correct |
4 ms |
652 KB |
Output is correct |
11 |
Correct |
5 ms |
652 KB |
Output is correct |
12 |
Correct |
6 ms |
644 KB |
Output is correct |
13 |
Correct |
4 ms |
644 KB |
Output is correct |
14 |
Correct |
4 ms |
648 KB |
Output is correct |
15 |
Correct |
4 ms |
644 KB |
Output is correct |
16 |
Correct |
4 ms |
652 KB |
Output is correct |
17 |
Correct |
4 ms |
644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
205 ms |
2492 KB |
Output is correct |
2 |
Correct |
211 ms |
2488 KB |
Output is correct |
3 |
Correct |
214 ms |
2500 KB |
Output is correct |
4 |
Correct |
204 ms |
2452 KB |
Output is correct |
5 |
Correct |
217 ms |
2496 KB |
Output is correct |
6 |
Correct |
210 ms |
2488 KB |
Output is correct |
7 |
Correct |
216 ms |
2456 KB |
Output is correct |
8 |
Correct |
210 ms |
2488 KB |
Output is correct |
9 |
Correct |
222 ms |
2440 KB |
Output is correct |
10 |
Correct |
213 ms |
2444 KB |
Output is correct |
11 |
Correct |
235 ms |
2488 KB |
Output is correct |
12 |
Correct |
216 ms |
2444 KB |
Output is correct |
13 |
Correct |
217 ms |
2496 KB |
Output is correct |
14 |
Correct |
216 ms |
2448 KB |
Output is correct |
15 |
Correct |
216 ms |
2496 KB |
Output is correct |
16 |
Correct |
209 ms |
2452 KB |
Output is correct |
17 |
Correct |
231 ms |
2448 KB |
Output is correct |
18 |
Correct |
218 ms |
2500 KB |
Output is correct |
19 |
Correct |
214 ms |
2448 KB |
Output is correct |