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 repf(i,k,n) for(int i=k; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
typedef vector<int> vi;
vi get_attachment(vi source){
int n=source.size(),k=(n>200 ? 8:6);
vi v(k,0);
rep(i,n){
rep(j,k) if(i&(1<<j)) v[j]^=source[i];
}
int x=0;
rep(i,n) x^=source[i];
v.push_back(x);
v.push_back(x);
return v;
}
vi retrieve(vi data){
//cerr<<"\n===\n";
int n=data.size();
n=(n>200 ? 255:63);
int k=(int)data.size()-n-2;
//if(data[n+k]!=data[n+k+1]) cerr<<"sol0\n";
if(data[n+k]!=data[n+k+1]) return vi(data.begin(),data.end()-k-2);
int x1=0; rep(i,n) x1^=data[i];
//if(x1==data.back()) cerr<<"sol1\n";
if(x1==data.back()) return vi(data.begin(),data.end()-k-2);
vi v(k,0);
rep(i,n){
rep(j,k) if(i&(1<<j)) v[j]^=data[i];
}
vi w(k); rep(i,k) w[i]=data[i+n];
//rep(i,k) cerr << w[i] << ' '; cerr<<'\n';
//rep(i,k) cerr << v[i] << ' '; cerr << '\n';
int x=0;
rep(i,k){
if(v[i]^w[i]) x^=(1<<i);
}
//cerr<<"flipped: " << x << '\n';
data[x]^=1;
//cerr<<"sol2\n";
return vi(data.begin(),data.end()-k-2);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |