# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
952377 | SmuggingSpun | Data Transfer (IOI19_transfer) | C++14 | 7 ms | 4620 KiB |
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 BIT = (source.size() == 63 ? 6 : 8), x = 0, cnt_1 = 0;
for(int i = 0; i < source.size(); i++){
if(source[i] == 1){
x ^= i + 1;
cnt_1++;
}
}
vector<int>data = source;
for(int i = 0; i < BIT; i++){
if(1 << i & x){
data.emplace_back(1);
}
else{
data.emplace_back(0);
}
}
data.emplace_back(cnt_1 & 1);
return data;
}
vector<int>retrieve(vector<int>data){
int BIT = (data.size() == 70 ? 6 : 8), n = (BIT == 6 ? 63 : 255), sum_xor = 0, data_xor = 0, cnt_1 = 0;
vector<int>ans(n);
for(int i = 0; i < n; i++){
if(data[i] == 1){
sum_xor ^= i + 1;
cnt_1++;
}
ans[i] = data[i];
}
for(int i = 0; i < BIT; i++){
if(data[n + i] == 1){
data_xor |= 1 << i;
}
}
if(data_xor != sum_xor && (cnt_1 & 1) != data.back()){
ans[(data_xor ^ sum_xor) - 1] ^= 1;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |