# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006168 | m5588ohammed | Data Transfer (IOI19_transfer) | C++17 | 5 ms | 5396 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;
int n=255;
vector<int> get_attachment(vector <int> source) {
int cnt=0,sum=0,k;
for(int i=0;i<source.size();i++){
if(source[i]==1){
sum++;
cnt^=i;
}
}
vector <int> ans=source;
k=sum%2;
while(cnt!=0){
ans.push_back(cnt%2);
cnt/=2;
}
ans.push_back(k);
return ans;
}
vector<int> retrieve(vector<int> data) {
int cnt=0,sum=0,k=data[data.size()-1],num=0;
int n = (data.size() > 255 ? 255 : 63);
for(int i=0;i<n;i++){
if(data[i]==1){
sum++;
cnt^=i;
}
}
for(int i=n;i<data.size()-1;i++) num+=data[i]*(1<<(i-n));
if(sum%2!=k&&cnt!=num) data[cnt^num]^=1;
vector <int> ans;
for(int i=0;i<n;i++) ans.push_back(data[i]);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |