Submission #199341

#TimeUsernameProblemLanguageResultExecution timeMemory
199341alexandra_udristoiuParrots (IOI11_parrots)C++14
81 / 100
16 ms1784 KiB
#include<iostream> #include "encoder.h" #include "encoderlib.h" using namespace std; void encode(int n, int v[]){ int i, x; for(i = 0; i < n; i++){ x = v[i]; send(i * 8 + x % 8); x /= 8; send(i * 8 + x % 8); send(i * 8 + x % 8); x /= 8; send(i * 8 + x % 8); send(i * 8 + x % 8); send(i * 8 + x % 8); send(i * 8 + x % 8); } }
#include<iostream> #include<algorithm> #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int n, int m, int v[]){ int i, p, j, nr; int sol[40]; for(i = 0; i < n; i++){ sol[i] = 0; } sort(v, v + m); for(i = 0; i < m; i++){ nr = 1; j = i; while(v[j + 1] == v[i] && j + 1 < m){ j++; nr++; } p = v[i] / 8; v[i] %= 8; if(nr >= 4){ sol[p] += v[i] * 64; nr -= 4; } if(nr >= 2){ sol[p] += v[i] * 8; nr -= 2; } if(nr == 1){ sol[p] += v[i]; } i = j; } for(i = 0; i < n; i++){ output(sol[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...