| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360281 | thinknoexit | Data Transfer (IOI19_transfer) | C++20 | 142 ms | 1724 KiB |
#include "transfer.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> get_attachment(vector<int> source) {
int n = source.size();
int c = 0;
if (n == 63) c = 7;
else c = 9;
vector<int> res(c, 0);
for (int j = 0;j < c - 1;j++) {
for (int i = 1;i <= n;i++) {
if ((i >> j) & 1) res[j] ^= source[i - 1];
}
}
for (int i = 0;i < n;i++) res[c - 1] ^= source[i];
return res;
}
vector<int> retrieve(vector<int> data) {
int n = data.size();
int c = 0;
if (n < 200) c = 7;
else c = 9;
vector<int> res(c, 0);
n -= c;
for (int j = 0;j < c - 1;j++) {
for (int i = 1;i <= n;i++) {
if ((i >> j) & 1) res[j] ^= data[i - 1];
}
}
for (int i = 0;i < n;i++) res[c - 1] ^= data[i];
int cnt = 0;
int pos = 0;
for (int j = 0;j < c;j++) if (data[n + j] != res[j]) {
cnt++;
if (j < c - 1) pos ^= (1 << j);
}
if (cnt > 1) data[pos - 1] ^= 1;
vector<int> ans = vector<int>(data.begin(), data.end() - c);
// cout << pos - 1 << ' ';
// for (auto& x : ans) cout << x;
// cout << '\n';
return ans;
}
/*
1 2 3 4 5 6 7
X X X X 0
X X X X 1
X X X X 2
X X X X X X X 3
*/Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
