Submission #870798

#TimeUsernameProblemLanguageResultExecution timeMemory
87079812345678Parrots (IOI11_parrots)C++17
81 / 100
4 ms1504 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { for(int i=0; i<N; i++) { for (int j=0; j<4; j++) { int tmp=16*(i/2); tmp+=j*4; tmp+=(M[i]&((1<<(2*j))+(1<<(2*j+1))))>>(2*j); send(tmp); if (i%2==1) send(tmp); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { vector<int> ans(N); int id, k; map<int, int> mp; for (int i=0; i<L; i++) mp[X[i]]++; for (auto [x, y]:mp) { k=(x/4)%4; if (y==1) { id=(x/16)*2; ans[id]+=(x%2)<<(2*k); ans[id]+=((x/2)%2)<<(2*k+1); } if (y==2) { id=(x/16)*2+1; ans[id]+=(x%2)<<(2*k); ans[id]+=((x/2)%2)<<(2*k+1); } if (y==3) { id=(x/16)*2; ans[id]+=(x%2)<<(2*k); ans[id]+=((x/2)%2)<<(2*k+1); id=(x/16)*2+1; ans[id]+=(x%2)<<(2*k); ans[id]+=((x/2)%2)<<(2*k+1); } } for (int i=0; i<N; i++) output(ans[i]); } /* 10 1 1 2 1 2 3 1 7 10 9 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...