제출 #934685

#제출 시각아이디문제언어결과실행 시간메모리
934685tamyte앵무새 (IOI11_parrots)C++14
0 / 100
1 ms1312 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { int i; for(i=0; i<N; i++) { int now = i; for (int j = 0; j < 4; ++j) { if ((1 << j) & M[i]) { now += (1 << (4 + j)); } } // std::cout << now << " + "; send(now); send(now); now = i; for (int j = 4; j < 8; ++j) { if ((1 << j) & M[i]) { now += (1 << (j)); } } // std::cout << now << "\n"; send(now); } }
#include "decoder.h" #include "decoderlib.h" #include <vector> void decode(int N, int L, int X[]) { int i; std::vector<std::vector<int>> res(N, std::vector<int>(2, -1)); for(i=0; i<L; i++) { int num = 0; for (int j = (1 << 4); j <= X[i]; j <<= 1) { if (j & X[i]) { num += (j >> 4); } } int idx = 0; for (int j = 0; j < 4; ++j) { if ((1 << j) & X[i]) { idx += (1 << j); } } // std::cout << idx << " " << num << " <- " << X[i] << "\n"; if (res[idx][0] != -1) { if (res[idx][0] == num) { std::swap(res[idx][0], res[idx][1]); } } else { res[idx][0] = num; } } for (int i = 0; i < N; ++i) { if (res[i][0] == -1) res[i][0] = 0; if (res[i][1] == -1) res[i][1] = 0; int num = ((res[i][0] << 4) + res[i][1]); // std::cout << i << ": " << res[i][0] << " " << (res[i][1] << 4) << "\n"; output(num); } }
#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...