This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int x = 0;
int n = source.size();
for(int i = 1; i <= n; i++){
if(source[i - 1]) x ^= i;
}
vector<int> v;
int l = 0;
if(n == 63) l = 6;
else l = 8;
for(int i = 0; i < l; i++){
v.push_back(bool(x & (1 << i)));
}
for(int i = 0; i < l; i++){
v.push_back(bool(x & (1 << i)));
}
return v;
}
vector<int> retrieve(vector<int> data) {
int n, l;
if(data.size() == 63 + 6 + 6) n = 63, l = 6;
else n = 255, l = 8;
int x = 0;
for(int i = 1; i <= n; i++){
if(data[i - 1]) x ^= i;
}
int x1 = 0, x2 = 0;
for(int i = 0; i < l; i++){
if(data[n + i]){
x1 |= (1 << i);
}
}
for(int i = 0; i < l; i++){
if(data[n + l + i]){
x2 |= (1 << i);
}
}
if(x1 == x2){
if(x != x1) data[(x ^ x1) - 1] ^= 1;
}
vector<int> v;
for(int i = 0; i < n; i++) v.push_back(data[i]);
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |