제출 #345815

#제출 시각아이디문제언어결과실행 시간메모리
345815casperwang앵무새 (IOI11_parrots)C++14
98 / 100
10 ms1700 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { int cnt = 0; for (int i = 0; i < N; i++) cnt += __builtin_popcount(M[i]); bool flag = (cnt > 4*N+2); if (flag) for (int i = 0; i < 4; i++) send(0); for (int i = 0; i < N; i++) { for (int j = 0; j < 4; j++) { int v = ((M[i]&(1<<(j*2)))>0) + 2*((M[i]&(1<<(j*2+1)))>0); if (flag) v = 3-v; while (v--) send(i*4 + j); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { vector <int> cnt(1<<8); vector <int> ans(N); for (int i = 0; i < L; i++) cnt[X[i]]++; bool flag = cnt[0] >= 4; if (flag) { for (int i = 0; i < N; i++) ans[i] = (1<<8)-1; cnt[0] -= 4; } for (int i = 0; i < L; i++) { if (!cnt[X[i]]) continue; cnt[X[i]]--; int id = X[i] / 4, k = X[i] % 4; if (flag) { ans[id] -= (1<<(k*2)); } else { ans[id] += (1<<(k*2)); } } for (int i = 0; i < N; i++) output(ans[i]); }
#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...