#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int i,n,j,cnt[10],ch=0,k;
n=source.size();
memset(cnt,0,sizeof cnt);
if(n==63) k=6;
else k=8;
for(i=0;i<n;i++){
if(source[i]!=1) continue;
for(j=0;j<k;j++){
if(((i+1)&(1<<j))!=0) cnt[j]=1-cnt[j];
}
ch=1-ch;
}
vector<int> ans;
ans.clear();
for(i=0;i<k;i++) ans.push_back(cnt[i]);
ans.push_back(ch);
return ans;
}
vector<int> retrieve(vector<int> data) {
int n=data.size(),k,cnt[10],ch=0,m=0,i,j;
if(n<100) n=63,k=6;
else n=255,k=8;
memset(cnt,0,sizeof cnt);
for(i=0;i<n;i++){
if(data[i]!=1) continue;
for(j=0;j<k;j++){
if(((i+1)&(1<<j))!=0) cnt[j]=1-cnt[j];
}
ch=1-ch;
}
vector<int> ans;
ans.clear();
if(ch==data[n+k]){
for(i=0;i<n;i++){
ans.push_back(data[i]);
}
return ans;
}else{
for(j=0;j<k;j++){
if(data[n+j]!=cnt[j]){
m+=(1<<j);
}
}
for(i=0;i<n;i++){
if((i+1)!=m) ans.push_back(data[i]);
else ans.push_back(1-data[i]);
}
return ans;
}
}
/*
15
1 011001010110110110100111110011010111111111111000101011100101001
2 011001010110110110100111110011010111111111111000101011100101001
3 011001010110110110100111110011010111111111111000101011100101001
4 011001010110110110100111110011010111111111111000101011100101001
6 011001010110110110100111110011010111111111111000101011100101001
9 011001010110110110100111110011010111111111111000101011100101001
8 011001010110110110100111110011010111111111111000101011100101001
10 011001010110110110100111110011010111111111111000101011100101001
63 011001010110110110100111110011010111111111111000101011100101001
52 011001010110110110100111110011010111111111111000101011100101001
51 011001010110110110100111110011010111111111111000101011100101001
54 011001010110110110100111110011010111111111111000101011100101001
2 011001010110110110100111110011010111111111111000101011100101001
12 011001010110110110100111110011010111111111111000101011100101001
50 011001010110110110100111110011010111111111111000101011100101001
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
624 KB |
Output is correct |
2 |
Correct |
6 ms |
780 KB |
Output is correct |
3 |
Correct |
6 ms |
704 KB |
Output is correct |
4 |
Correct |
6 ms |
628 KB |
Output is correct |
5 |
Correct |
6 ms |
620 KB |
Output is correct |
6 |
Correct |
6 ms |
716 KB |
Output is correct |
7 |
Correct |
7 ms |
700 KB |
Output is correct |
8 |
Correct |
8 ms |
620 KB |
Output is correct |
9 |
Correct |
8 ms |
704 KB |
Output is correct |
10 |
Correct |
9 ms |
644 KB |
Output is correct |
11 |
Correct |
8 ms |
704 KB |
Output is correct |
12 |
Correct |
9 ms |
620 KB |
Output is correct |
13 |
Correct |
7 ms |
696 KB |
Output is correct |
14 |
Correct |
7 ms |
600 KB |
Output is correct |
15 |
Correct |
7 ms |
708 KB |
Output is correct |
16 |
Correct |
8 ms |
688 KB |
Output is correct |
17 |
Correct |
7 ms |
696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
2464 KB |
Output is correct |
2 |
Correct |
158 ms |
2468 KB |
Output is correct |
3 |
Correct |
138 ms |
2468 KB |
Output is correct |
4 |
Correct |
151 ms |
2484 KB |
Output is correct |
5 |
Correct |
219 ms |
2464 KB |
Output is correct |
6 |
Correct |
276 ms |
2524 KB |
Output is correct |
7 |
Correct |
371 ms |
2464 KB |
Output is correct |
8 |
Correct |
389 ms |
2468 KB |
Output is correct |
9 |
Correct |
404 ms |
2468 KB |
Output is correct |
10 |
Correct |
411 ms |
2464 KB |
Output is correct |
11 |
Correct |
408 ms |
2476 KB |
Output is correct |
12 |
Correct |
295 ms |
2464 KB |
Output is correct |
13 |
Correct |
296 ms |
2432 KB |
Output is correct |
14 |
Correct |
272 ms |
2468 KB |
Output is correct |
15 |
Correct |
288 ms |
2464 KB |
Output is correct |
16 |
Correct |
264 ms |
2464 KB |
Output is correct |
17 |
Correct |
263 ms |
2464 KB |
Output is correct |
18 |
Correct |
258 ms |
2464 KB |
Output is correct |
19 |
Correct |
257 ms |
2428 KB |
Output is correct |