Submission #62175

#TimeUsernameProblemLanguageResultExecution timeMemory
62175aomeParrots (IOI11_parrots)C++17
96 / 100
19 ms2432 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) { int P = -1; for (int j = 0; j < i; ++j) { if (M[j] == M[i]) { P = j; break; } } int val = M[i]; if (P != -1) val = 256 + P; for (int j = 0; j < 4; ++j) { int tmp = val % 5; val /= 5; while (tmp--) send(i * 4 + j); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; int res[64]; int cnt[256]; void decode(int N, int L, int X[]) { memset(cnt, 0, sizeof cnt); for (int i = 0; i < L; ++i) cnt[X[i]]++; for (int i = 0; i < N; ++i) { int val = 0; for (int j = 3; j >= 0; --j) { val = val * 5 + cnt[i * 4 + j]; } if (val < 256) res[i] = val; else res[i] = res[val - 256]; output(res[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...