Submission #999654

#TimeUsernameProblemLanguageResultExecution timeMemory
99965412345678Data Transfer (IOI19_transfer)C++17
0 / 100
4 ms2516 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; std::vector<int> get_attachment(std::vector<int> source) { int sz=(source.size()<100)?6:8, sm=0, cnt=0; vector<int> v; for (int i=1; i<(1<<sz); i++) if (source[i]) sm^=i; for (int i=0; i<sz; i++) v.push_back((sm>>i)&1), cnt+=((sm>>i)&1); v.push_back(cnt%2); return v; } std::vector<int> retrieve(std::vector<int> data) { int sz=(data.size()<100)?6:8, n, sm=0, tmp=0; if (sz==6) n=63; else n=255; for (int i=0; i<n; i++) if (data[i]) sm^=i; for (int i=n; i<n+sz; i++) if (data[i]) tmp+=(i<<(i-n)); if (tmp==sm||(__builtin_popcount(tmp)%2)!=data.back()) return std::vector<int>(data.begin(), data.begin()+n); int c=sm^tmp; data[c]^=1; //cout<<"debug "<<c<<'\n'; return std::vector<int>(data.begin(), data.begin()+n); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...