제출 #796027

#제출 시각아이디문제언어결과실행 시간메모리
796027khshg앵무새 (IOI11_parrots)C++14
98 / 100
7 ms1356 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { vector<array<int, 4>> H; for(int Os = 0; Os <= 7; ++Os) { for(int Is = 0; Is + Os <= 7; ++Is) { for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) { for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) { H.push_back({Os, Is, Zs, Es}); } } } } sort(begin(H), end(H)); for(int i = 0; i < N; ++i) { array<int, 4> k = H[M[i]]; for(int x : {0, 1, 2, 3}) while(k[x]--) send(((i << 2) ^ x)); } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { int H[8][8][8][8]; memset(H, -1, sizeof(H)); for(int Os = 0, C = 0; Os <= 7; ++Os) { for(int Is = 0; Is + Os <= 7; ++Is) { for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) { for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) { H[Os][Is][Zs][Es] = C++; } } } } vector<array<int, 4>> cnt(N); for(int i = 0; i < L; ++i) { ++cnt[(X[i] >> 2)][(X[i] & 3)]; } for(int i = 0; i < N; ++i) { output(H[cnt[i][0]][cnt[i][1]][cnt[i][2]][cnt[i][3]]); } }
#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...