# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829615 | FEDIKUS | Data Transfer (IOI19_transfer) | C++17 | 190 ms | 2496 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 "transfer.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> get_attachment(vector<int> source){
int dodajem=0;
if(int(source.size())==63) dodajem=6;
if(int(source.size())==255) dodajem=8;
vector<int> novi;
for(int i=0;i<dodajem;i++){
int sta=0;
for(int j=0;j<int(source.size());j++){
if((j+1) & (1<<i)) sta^=source[j];
}
novi.push_back(sta);
}
int sta=0;
for(int i=0;i<int(novi.size());i++) sta^=novi[i];
novi.push_back(sta);
for(int i:novi) source.push_back(i);
return novi;
}
vector<int> retrieve(vector<int> data) {
int dodajem=0;
if(int(data.size())>100) dodajem=8;
else dodajem=6;
int kraj=0;
for(int i=int(data.size())-dodajem-1;i<int(data.size());i++){
kraj^=data[i];
}
if(kraj) return vector<int>(data.begin(),data.end()-dodajem-1);
int koji=0;
bool ima=false;
for(int i=int(data.size())-dodajem-1;i<int(data.size())-1;i++){
int bit=i-(int(data.size()-dodajem-1));
int sta=0;
for(int j=0;j<int(data.size())-dodajem-1;j++){
if((j+1) &(1<<bit)) sta^=data[j];
}
if(sta!=data[i]){
ima=true;
koji+=(1<<bit);
}
}
koji--;
if(koji>=0) data[koji]=1-data[koji];
return vector<int>(data.begin(),data.end()-dodajem-1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |