Submission #829615

#TimeUsernameProblemLanguageResultExecution timeMemory
829615FEDIKUSData Transfer (IOI19_transfer)C++17
100 / 100
190 ms2496 KiB
#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)

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:35:7: warning: variable 'ima' set but not used [-Wunused-but-set-variable]
   35 |  bool ima=false;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...