| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1356720 | AMel0n | Data Transfer (IOI19_transfer) | C++20 | 50 ms | 1724 KiB |
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source) {
int K = (source.size() <= 63 ? 6 : 8);
vector<int> res;
res.push_back(accumulate(source.begin(), source.end(), 0) % 2);
int xorr = 0;
for(int i = 0; i < source.size(); i++) {
if (source[i]) xorr ^= (i+1);
}
for(int j = K-1; j >= 0; j--) {
if (xorr & (1 << j)) res.push_back(1);
else res.push_back(0);
}
return res;
}
vector<int> retrieve(vector<int> data) {
int K = (data.size() - 7 <= 63 ? 6 : 8);
int N = data.size() - K - 1;
int parity = data[N];
int xorr = 0;
for(int i = N+1, j = K-1; i < data.size(); i++, j--) {
if (data[i]) xorr ^= (1 << j);
}
vector<int> res;
int xorr2 = 0;
for(int i = 0; i < N; i++) {
res.push_back(data[i]);
if (data[i]) xorr2 ^= (i+1);
}
if (xorr2 == xorr || parity == accumulate(res.begin(), res.end(), 0) % 2) return res;
res[(xorr ^ xorr2)-1] ^= 1;
return res;
}Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
