Submission #310790

#TimeUsernameProblemLanguageResultExecution timeMemory
310790LucaDantasParrots (IOI11_parrots)C++17
98 / 100
9 ms1792 KiB
#include "encoder.h" #include "encoderlib.h" #include<cstdio> #include<cstring> int conta[300]; inline int abs(int x) {return x<0?-x:x;} void encode(int N, int M[]) { memset(conta, 0, sizeof conta); int tot = 0; for(int i = 0; i < N; i++) { for(int bit = 0; bit < 4; bit++) { int cnt = (M[i] >> (2*bit))&3; // while(cnt--) send(4*i+bit); conta[4*i+bit] = cnt; tot += cnt; } } int ok = 0; if(tot > N * 6) ok = 3, send(0), send(0), send(0), send(0); for(int i = 0; i < 4*N; i++) { int qtd = abs(ok - conta[i]); while(qtd--) send(i);/*, printf("%d\n", abs(ok - conta[i]))*/; } }
#include "decoder.h" #include "decoderlib.h" #include<cstdio> #include<cstring> #include<algorithm> int cnt[10000]; inline int abs(int x) {return x<0?-x:x;} 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 < 4*N; i++) // printf("%d ", cnt[i]); // printf("\n"); int ok = 0; if(cnt[0] >= 4) ok = 3, cnt[0] -= 4; for(int i = 0; i < N; i++) { int here = 0; for(int j = 0; j < 4; j++) { // printf("%d\n", ok); here += (abs(ok-cnt[4*i+j])) << (2*j); } // printf("%d\n", here); output(here); } }
#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...