Submission #819076

#TimeUsernameProblemLanguageResultExecution timeMemory
819076AlphaBruhData Transfer (IOI19_transfer)C++14
100 / 100
81 ms2500 KiB
#include "transfer.h" #include<bits/stdc++.h> using namespace std; std::vector<int> get_attachment(std::vector<int> source) { int x = 0,n=source.size(); for(int i = 0; i < n;i++){ if(source[i]==1){ x = (i+1) xor x; } } std::vector<int>rt; if(n<=63){ int e=0,m=32; for(int i = 0; i < 6; i++){ rt.push_back(x/m); x%=m; m = m>>1; } for(int i : rt){ e = e xor i; } rt.push_back(e); } else{ int e=0,m=128; for(int i = 0; i < 8; i++){ rt.push_back(x/m); x%=m; m = m>>1; } for(int i : rt){ e = e xor i; } rt.push_back(e); } return rt; } std::vector<int> retrieve(std::vector<int> data) { int n = data.size(); vector<int>odata; vector<int>dbgc; if(n<=75){ for(int i =0; i < 63; i++){ odata.push_back(data[i]); } for(int i = 63; i < n; i++){ dbgc.push_back(data[i]); } } else{ for(int i =0; i < 255; i++){ odata.push_back(data[i]); } for(int i = 255; i < n; i++){ dbgc.push_back(data[i]); } } int dginc = 0; for(int i : dbgc){ dginc = dginc xor i; } if(dginc == 1) return odata; int dbcl = dbgc.size()-1; int x = 0; for(int i = 0; i <dbcl; i++){ x = (x<<1)+(dbgc[i]); } int bx = 0; n = odata.size(); for(int i = 0; i < n; i++){ if(odata[i]==1){ bx = bx xor (i+1); } } int bp = bx xor x; if(bp>0) odata[bp-1] = 1-odata[bp-1]; return odata; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...