# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713861 | chenyan | Data Transfer (IOI19_transfer) | C++17 | 60 ms | 2548 KiB |
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 pb push_back
/*
vector<int> get_attachment(vector<int>a){
int i,v=0;
for(int u:a)v^=u;
a.pb(v);
return a;
}
vector<int>retrieve(vector<int>a){
int k=a.back(),v=0,u=0,i;
a.pop_back();
for(i=0;i<a.size()/2;i++){
v^=a[i];
u^=a[i+a.size()/2];
}
if(v==u){
a.resize(a.size()/2);
return a;
}
vector<int>ans;
for(i=0;i<a.size()/2;i++){
ans.pb(a[i+(v==k?0:(int)a.size()/2)]);
}
return ans;
}
*/
vector<int> get_attachment(vector<int> a){
int v=0,i,n=a.size(),cnt=0;
for(i=1;i<=n;i++)if(a[i-1])v^=i,cnt++;
vector<int>r;
for(i=(n<=63?6:8);i>=0;i--) r.pb((v>>i)&1);
r.pb(cnt&1);
return r;
}
vector<int>retrieve(vector<int> a){
int i,j,n=a.size(),k,v=0,u=0,cnt=0;
if(n<=71)n-=8,k=8;
else n=255,k=10;
for(i=1;i<=n;i++){
if(a[i-1])v^=i,cnt++;
}
for(i=0;i<k-1;i++){
u+=(a[i+n]<<(k-2-i));
}
if(u==v||(cnt&1)==a[n+k-1]){
a.resize(n);
return a;
}
a[(u^v)-1]^=1;
a.resize(n);
return a;
}
/*
int main(){
int n;
cin>>n;
vector<int>v(n);
for(int i=0;i<n;i++)cin>>v[i];
vector<int>u=get_attachment(v);
for(int k:u)cout<<k<<' ';
cout<<'\n';
int k;
cin>>k;
u[k]^=1;
for(int u:retrieve(u))
cout<<u<<' ';
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |