Submission #573309

#TimeUsernameProblemLanguageResultExecution timeMemory
573309TimDeeParrots (IOI11_parrots)C++14
24 / 100
12 ms1368 KiB
#include "encoder.h" #include "encoderlib.h" #define forn(i,n) for (int i=0; i<n; i++) void encode(int n, int message[]) { forn(i,n) { int x=message[i]; int add=i*4; int a=x%4; forn(i,a) send(add); x/=4; a=x%4; forn(i,a) send(add+1); x/=4; a=x%4; forn(i,a) send(add+2); x/=4; a=x%4; forn(i,a) send(add+3); x/=4; } }
#include "decoder.h" #include "decoderlib.h" #define forn(i,n) for (int i=0; i<n; i++) struct node { int fcnt=0,scnt=0,tcnt=0,pcnt=0; }; void decode(int N, int L, int message[]) { int a[N]; node v[N]; forn(i,N) a[i]=0; forn(i,L) { int x=message[i]; int j=x/4; int k=x%4; if (k==0) { v[j].fcnt++; } else if (k==1) { v[j].scnt++; } else if (k==2) { v[j].tcnt++; } else { v[j].pcnt++; } } forn(i,N) { int fcnt=v[i].fcnt; a[i]+=fcnt; int scnt=v[i].scnt; a[i]+=scnt*4; int tcnt=v[i].tcnt; a[i]+=tcnt*16; int pcnt=v[i].pcnt; a[i]+=pcnt*64; output(a[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...