# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711058 | Pring | Data Transfer (IOI19_transfer) | C++14 | 0 ms | 0 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 n = source.size();
vector<int> modify(n + 9);
int x = 0, y = 0;
for (int i = 0; i < n; i++) {
modify[i] = source[i];
if (modify[i]) x |= (i + 1);
}
for (int i = 0; i < 8; i++) {
modify[n + i] = (bool) (x | (1 << i));
if (modify[n + i]) y ^= 1;
}
modify.back() = y;
return modify;
}
vector<int> retrieve(vectot<int> data) {
int n = data.size() - 9;
vector<int> ans(n);
for (int i = 0; i < n; i++) ans[i] = data[i];
int x = 0, y = 0;
for (int i = 0; i < 8; i++) {
if (data[n + i]) {
x += (1 << i);
y ^= 1;
}
}
if (y != data.back()) return ans;
for (int i = 0; i < n; i++) {
if (ans[i]) x |= i + 1;
}
if (x == 0) return ans;
ans[x - 1] ^= 1;
return ans;
}
int main() {
string s;
cin >> s;
int n = s.size();
vector<int> v(n);
for (int i = 0; i < n; i++) v[i] = s[i] & 1;
vector<int> w = retrieve(get_attachment)
}