Submission #62177

#TimeUsernameProblemLanguageResultExecution timeMemory
62177aomeParrots (IOI11_parrots)C++17
98 / 100
26 ms2536 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; int A2[625], B2[320]; void encode(int N, int M[]) { vector< pair<int, int> > vec; for (int i = 0; i < 625; ++i) { int val = i; int cnt = 0; for (int j = 0; j < 4; ++j) { cnt += val % 5, val /= 5; } vec.push_back({cnt, i}); } sort(vec.begin(), vec.end()); for (int i = 0; i < 320; ++i) A2[vec[i].second] = i, B2[i] = vec[i].second; 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; val = B2[val]; 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]; int A[625], B[320]; void decode(int N, int L, int X[]) { vector< pair<int, int> > vec; for (int i = 0; i < 625; ++i) { int val = i; int cnt = 0; for (int j = 0; j < 4; ++j) { cnt += val % 5, val /= 5; } vec.push_back({cnt, i}); } sort(vec.begin(), vec.end()); for (int i = 0; i < 320; ++i) A[vec[i].second] = i, B[i] = vec[i].second; 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]; } val = A[val]; 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...