# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45417 | smu201111192 | Parrots (IOI11_parrots) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "decoder.h"
#include "decoderlib.h"
int ccnt[256];
int ans[65];
void decode(int N, int L, int X[])
{
for(int i = 0; i < L; i++){
ccnt[X[i]]++;
}
int rev = 0;
if(ccnt[255] >= 4){
rev = 1; ccnt[255] -= 4;
}
for(int i = 0; i < 256; i++){
int piv = i / 8;
int add = i % 8;
//if(ccnt[i] == 0 && piv + 32 >= N) continue;
if(ccnt[i] == 0){
if(rev)
{
ans[piv] |= (1<<add);
ans[piv+32] |= (1<<add);
}
}
else if(ccnt[i] == 1 ){
ans[piv] |= (1<<add);
}
else if(ccnt[i] == 2){
ans[piv+32] |= (1<<add);
}
else if(ccnt[i] == 3){
if(!rev) {
ans[piv] |= (1<<add);
ans[piv+32] |= (1<<add);
}
}
}
for(int i = 0; i < N; i++){
output(ans[i]);
}
}