Submission #995369

#TimeUsernameProblemLanguageResultExecution timeMemory
995369BorsData Transfer (IOI19_transfer)C++17
80 / 100
231 ms2760 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...