# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829649 | Rifal | Data Transfer (IOI19_transfer) | C++14 | 6 ms | 2492 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 <bits/stdc++.h>
#include "transfer.h"
using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
vector<int> v; int cnt = 0;
for(int i = 0; i < source.size(); i++) {
/// v.push_back(source[i]);
if(source[i] == 1) cnt ^= i;
}
int cnt2 = 0;
for(int i = 0; i < 8; i++) {
if((cnt&(1<<i)) > 0) {
v.push_back(1); cnt2++;
}
else {
v.push_back(0);
}
}
if(cnt2%2 == 0) v.push_back(0);
else v.push_back(1);
return v;
}
std::vector<int> retrieve(std::vector<int> data) {
vector<int> v;
int siz = data.size(); int a = 0, b = 0, cnt = 0;
for(int i = 0; i < siz-9; i++) {
v.push_back(data[i]);
if(data[i] == 1) a ^= i;
}
for(int i = siz-9; i < siz-2; i++) {
if(data[i] == 1) {
b += (1<<(i-(siz-9))); cnt++;}
}
if(b == a) return v;
if(cnt%2 != data[siz-1]) return v;
int x = (a^b); v[x] ^= 1;
return v;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |