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 "iostream"
using namespace std;
vector<int> solve63(vector<int>& data) {
int xsl = 0;
int xsr = 0;
for (int i = 63; i < 69; i ++)
xsr |= data[i] * (1 << (i - 63));
for (int i = 1; i <= 63; i ++)
xsl ^= data[i - 1] * i;
int ev = data[69];
vector<int> v(data.begin(), data.begin() + 63);
if (ev != (__builtin_popcount(xsr) & 1))
return v;
if (xsl == xsr) return v;
int vl = (xsl ^ xsr) - 1;
v[vl] = 1 - v[vl];
return v;
}
vector<int> solve255(vector<int>& data) {
int xsl = 0;
int xsr = 0;
for (int i = 255; i < 263; i ++)
xsr |= data[i] * (1 << (i - 255));
for (int i = 1; i <= 255; i ++)
xsl ^= data[i - 1] * i;
int ev = data[263];
vector<int> v(data.begin(), data.begin() + 255);
if (ev != (__builtin_popcount(xsr) & 1))
return v;
if (xsl == xsr) return v;
int vl = (xsl ^ xsr) - 1;
v[vl] = 1 - v[vl];
return v;
}
vector<int> get_attachment(vector<int> source) {
int n = source.size();
int xs = 0;
for (int i = 1; i <= n; i ++)
xs ^= source[i - 1] * i;
//cout << xs << '\n';
vector<int> v;
if (63 == n)
for (int i = 0; i < 6; i ++) {
int b = 0 < (xs & (1 << i));
v.push_back(b);
}
else
for (int i = 0; i < 8; i ++) {
int b = 0 < (xs & (1 << i));
v.push_back(b);
}
v.push_back(__builtin_popcount(xs) & 1);
return v;
}
vector<int> retrieve(vector<int> data) {
int m = data.size();
if (70 == m)
return solve63(data);
return solve255(data);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |