제출 #74129

#제출 시각아이디문제언어결과실행 시간메모리
74129admin앵무새 (IOI11_parrots)C++17
98 / 100
9 ms1784 KiB
#include "encoder.h" #include "encoderlib.h" int count[1000]; void encode (int N, int M[]) { // 6N approach int c1 = 0, c0 = 0; for(int i = 0; i < N; i++) { for(int j = 0; j < 4; j++) { count[i*4+j] = !!(M[i] & 1<<(j*2+1))*2 + !!(M[i] & 1<<(j*2)); c1 += count[i*4+j]; } } c0 = N * 4 * 3 - c1; if(c1 < c0) { for(int i = 0; i < N * 4; i++) while(count[i]--) send(i); }else { send(0); send(0); send(0); send(0); for(int i = 0; i < N * 4; i++) { count[i] = 3 - count[i]; while(count[i]--) send(i); } } }
#include "decoder.h" #include "decoderlib.h" int count[1000]; void decode (int N, int L, int X[]) { int i, j; bool isc0 = false; for(i = 0; i < N * 4; i++) count[i] = 0; for(i = 0; i < L; i++) { ++count[X[i]]; if(count[0] == 4) isc0 = true; } if(isc0) { count[0] -= 4; for(i = 0; i < N * 4; i++) count[i] = 3 - count[i]; } for(i = 0; i < N; i++) { int ret = 0; for(j = 0; j < 4; j++) { ret |= count[i * 4 + j] << (2 * j); } output(ret); } }
#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...