Submission #288185

#TimeUsernameProblemLanguageResultExecution timeMemory
288185PyqeData Transfer (IOI19_transfer)C++14
100 / 100
538 ms2692 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; long long n,pn; bitset<269> a; void slv() { long long i,j,k,c; for(i=1;i<=n;i++) { c=0; for(j=0,k=i;k;k/=2,j++) { if(k&1) { a[n+1+j]=a[n+1+j]^a[i]; c++; } } if(c==1) { a[n+pn+1]=a[n+pn+1]^a[i]; } } } vector<int> get_attachment(vector<int> aa) { long long i; vector<int> sq; n=aa.size(); for(i=1;i<=n;i++) { a[i]=aa[i-1]; } pn=6+2*(n==255); for(i=n+1;i<=n+pn+1;i++) { a[i]=0; } slv(); for(i=n+1;i<=n+pn+1;i++) { sq.push_back(a[i]); } return sq; } vector<int> retrieve(vector<int> aa) { long long i,p=0,c=0; vector<int> sq; n=aa.size(); for(i=1;i<=n;i++) { a[i]=aa[i-1]; } pn=6+2*(n==264); n-=pn+1; slv(); for(i=0;i<pn;i++) { p|=a[n+1+i]<<i; c+=a[n+1+i]; } if(c>1||(c==1&&a[n+pn+1])) { a[p]=!a[p]; } for(i=1;i<=n;i++) { sq.push_back(a[i]); } return sq; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...