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(), lst = 0;
vector<int> ret;
for (int i = 0; i < __lg(N + 1); i++)
{
int t = 0;
for (int j = 0; j < N; j++)
if ((j + 1) & (1 << i))
t ^= source[j];
ret.push_back(t);
lst ^= t;
}
ret.push_back(lst);
return ret;
}
vector<int> retrieve(vector<int> data)
{
int N = (data.size() == 70 ? 63 : 255), K = data.size() - N;
vector<int> ret;
for (int i = 0; i < N; i++)
ret.push_back(data[i]);
int arr[6] = {};
for (int i = 0; i < __lg(N + 1); i++)
for (int j = 0; j < N; j++)
if ((j + 1) & (1 << i))
arr[i] ^= data[j];
int inc = 0;
for (int i = 0; i < __lg(N + 1); i++)
inc += (1 << i) * (arr[i] != data[N + i]);
int t = 0;
for (int i = N; i < N + K - 1; i++)
t ^= data[i];
if (inc && t == data[N + K - 1])
ret[inc - 1] = !ret[inc - 1];
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |