Submission #505097

#TimeUsernameProblemLanguageResultExecution timeMemory
505097mathking1021Parrots (IOI11_parrots)C++17
98 / 100
6 ms1272 KiB
#include "encoder.h" #include "encoderlib.h" #define n nnnnnnn1 #define a aaaaaaa1 #define c ccccccc1 #define sum sumsumsum typedef int ll; ll n; ll a[105]; ll sum = 0; ll c[265]; void encode(int N, int M[]) { n = N; for(ll i = 0; i < n; i++) { a[i] = M[i]; } sum = 0; for(ll i = 0; i < 256; i++) { c[i] = 0; } for(ll i = 0; i < n; i++) { ll b[4] = {a[i] % 4, a[i] / 4 % 4, a[i] / 16 % 4, a[i] / 64 % 4}; for(ll j = 0; j < 4; j++) { c[i * 4 + j] = b[j]; sum += c[i * 4 + j]; } } if(sum > n * 6) { for(ll i = 0; i < 4 * n; i++) { c[i] = 3 - c[i]; } send(0);send(0);send(0);send(0); } for(ll i = 0; i < 256; i++) { for(ll j = 0; j < c[i]; j++) { send(i); } } }
#include "decoder.h" #include "decoderlib.h" typedef int ll; ll n; ll m; ll a[10005]; ll b[265]; bool v = false; void decode(int N, int L, int X[]) { n = N; m = L; v = false; for(ll i = 0; i < 4 * n; i++) b[i] = 0; for(ll i = 0; i < m; i++) { a[i] = X[i]; b[a[i]]++; } if(b[0] >= 4) { b[0] -= 4, v = true; } for(ll i = 0; i < 4 * n; i++) { if(v) b[i] = 3 - b[i]; } for(ll i = 0; i < n; i++) { ll t1 = b[i * 4 + 0] * 1; ll t2 = b[i * 4 + 1] * 4; ll t3 = b[i * 4 + 2] * 16; ll t4 = b[i * 4 + 3] * 64; output(t1 + t2 + t3 + t4); } }
#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...