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(vector<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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |