#include "transfer.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
int n=source.size();
if(n==63){
vector<int> a(7),b(7);
for(int j=0;j<6;j++){
for(int i=0;i<n;i++){
if(i&(1<<j)){
b[j]^=source[i];
}
else{
a[j]^=source[i];
}
}
}
for(int i=0;i<n;i++){
a[6]^=source[i];
}
return a;
}
else{
vector<int> a(9),b(9);
for(int j=0;j<8;j++){
for(int i=0;i<n;i++){
if(i&(1<<j)){
b[j]^=source[i];
}
else{
a[j]^=source[i];
}
}
}
for(int i=0;i<n;i++){
a[8]^=source[i];
}
return a;
}
}
std::vector<int> retrieve(std::vector<int> data) {
vector<int> v=data;
int n=v.size();
if(n==70){
vector<int> a(6),b(6);
for(int i=63;i<69;i++){
a[i-63]=v[i];
b[i-63]=v[69]^a[i-63];
}
vector<int> a1(6),b1(6);
for(int j=0;j<6;j++){
for(int i=0;i<63;i++){
if(i&(1<<j)){
b1[j]^=v[i];
}
else{
a1[j]^=v[i];
}
}
}
int ans=0;
int cnt=0;
for(int j=0;j<6;j++){
if(a[j]!=a1[j]){
cnt++;
}
if(b[j]!=b1[j]){
cnt++;
ans^=(1<<j);
}
}
vector<int> ans1(63);
//cout<<cnt<<' '<<ans<<endl;
for(int i=0;i<63;i++){
ans1[i]=v[i];
}
if(cnt==6&&ans!=63){
ans1[ans]^=1;
}
return ans1;
}
else{
vector<int> a(8),b(8);
for(int i=255;i<263;i++){
a[i-255]=v[i];
b[i-255]=v[263]^a[i-255];
}
vector<int> a1(8),b1(8);
for(int j=0;j<8;j++){
for(int i=0;i<255;i++){
if(i&(1<<j)){
b1[j]^=v[i];
}
else{
a1[j]^=v[i];
}
}
}
int ans=0;
int cnt=0;
for(int j=0;j<8;j++){
if(a[j]!=a1[j]){
cnt++;
}
if(b[j]!=b1[j]){
cnt++;
ans^=(1<<j);
}
}
vector<int> ans1(255);
//cout<<cnt<<' '<<ans<<endl;
for(int i=0;i<255;i++){
ans1[i]=v[i];
}
if(cnt==8&&ans!=255){
ans1[ans]^=1;
}
return ans1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Correct |
4 ms |
640 KB |
Output is correct |
3 |
Correct |
5 ms |
644 KB |
Output is correct |
4 |
Correct |
4 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
5 ms |
640 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
4 ms |
648 KB |
Output is correct |
9 |
Correct |
4 ms |
640 KB |
Output is correct |
10 |
Correct |
5 ms |
732 KB |
Output is correct |
11 |
Correct |
4 ms |
724 KB |
Output is correct |
12 |
Correct |
5 ms |
652 KB |
Output is correct |
13 |
Correct |
4 ms |
640 KB |
Output is correct |
14 |
Correct |
5 ms |
648 KB |
Output is correct |
15 |
Correct |
5 ms |
648 KB |
Output is correct |
16 |
Correct |
5 ms |
640 KB |
Output is correct |
17 |
Correct |
5 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
255 ms |
2484 KB |
Output is correct |
2 |
Correct |
260 ms |
2448 KB |
Output is correct |
3 |
Correct |
251 ms |
2492 KB |
Output is correct |
4 |
Correct |
255 ms |
2488 KB |
Output is correct |
5 |
Correct |
250 ms |
2496 KB |
Output is correct |
6 |
Correct |
255 ms |
2496 KB |
Output is correct |
7 |
Correct |
257 ms |
2492 KB |
Output is correct |
8 |
Correct |
253 ms |
2488 KB |
Output is correct |
9 |
Correct |
252 ms |
2444 KB |
Output is correct |
10 |
Correct |
255 ms |
2500 KB |
Output is correct |
11 |
Correct |
254 ms |
2432 KB |
Output is correct |
12 |
Correct |
255 ms |
2488 KB |
Output is correct |
13 |
Correct |
249 ms |
2452 KB |
Output is correct |
14 |
Correct |
255 ms |
2512 KB |
Output is correct |
15 |
Correct |
251 ms |
2488 KB |
Output is correct |
16 |
Correct |
248 ms |
2488 KB |
Output is correct |
17 |
Correct |
257 ms |
2496 KB |
Output is correct |
18 |
Correct |
258 ms |
2496 KB |
Output is correct |
19 |
Correct |
252 ms |
2488 KB |
Output is correct |