제출 #595958

#제출 시각아이디문제언어결과실행 시간메모리
595958proma앵무새 (IOI11_parrots)C++17
81 / 100
5 ms1264 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 ++) { bitset<8>bs(M[i]); for (int j = 0; j < 8; j ++) { if (bs[j]) { int x = j; int pos = i; for (int k = 3; k < 8; k ++) { x += (pos % 2) * (1 << k); pos /= 2; } send(x); } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { vector <int> res(N); for (int i = 0; i < L; i ++) { bitset<8>bs(X[i]); int whichBit = 0; for (int j = 0; j < 3; j ++) { whichBit += bs[j] * (1 << j); } int pos = 0; for (int j = 3; j < 8; j ++) { pos += bs[j] * (1 << (j - 3)); } res[pos] += (1 << whichBit); } for (auto i: res) { // std::cout << i << " "; output(i); }// std::cout << std::endl; }
#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...