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>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL
vector<int> get_attachment(vector<int> a)
{
vector<int> r;
int xorr = 0;
int ind = 1;
int cnt = 0;
for(int x : a)
{
if(x) xorr^=ind;
ind++;
}
int w = 6;
if(len(a)==255) w = 8;
for(int i = 0;i<w;i++)
{
int bit = (xorr>>i)&1;
if(bit) cnt^=1;
r.pb(bit);
}
r.pb(cnt);
return r;
}
vector<int> retrieve(vector<int> a)
{
int l = 63;
int poc = 63;
int w = 6;
if(len(a)>80) l = 255, poc = 255, w = 8;
int xor1, xor2;
xor1 = xor2 = 0;
for(int i = 0;i<l;i++) if(a[i]) xor1^=(i+1);
int cnt = 0;
for(int i = poc;i-poc<w;i++)
{
int bit = a[i];
if(bit) cnt^=1;
xor2+=bit*(1<<(i-poc));
}
vector<int> r;
if(xor1==xor2)
{
for(int i = 0;i<l;i++) r.pb(a[i]);
return r;
}
if(cnt!=a[len(a)-1])
{
for(int i = 0;i<l;i++) r.pb(a[i]);
return r;
}
int p = xor1^xor2;
for(int i = 0;i<l;i++)
{
if(p==i+1) r.pb(a[i]^1);
else r.pb(a[i]);
}
return r;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |