# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711010 | becaido | Data Transfer (IOI19_transfer) | C++17 | 3062 ms | 2444 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;
vector<int> get_attachment(vector<int> source) {
int n = source.size();
vector<int> val(__lg(n + 1) + 1);
for (int i = 1, cnt = 0; cnt < n; i++) if (__builtin_popcount(i) > 1) {
if (source[cnt]) {
for (int j = 0; j <= __lg(n + 1); j++) {
val[j] ^= i >> j & 1;
}
}
cnt++;
}
return val;
}
vector<int> retrieve(vector<int> data) {
int n = data.size();
n = (n == 70 ? 63 : 255);
vector<int> val;
while (data.size() > n) {
val.emplace_back(data.back());
data.pop_back();
}
reverse(val.begin(), val.end());
if (get_attachment(data) == val) return data;
for (int &x : data) {
x ^= 1;
if (get_attachment(data) == val) return data;
x ^= 1;
}
return data;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |