# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235255 | DavidDamian | Parrots (IOI11_parrots) | C++11 | 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 "encoder.h"
#include "encoderlib.h"
void encode(int N, int M[])
{
for(int i=0;i<N;i++){
int number=(M[i])? 1 : 3;
number*=(1<<i);
send(number);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
vector<int> ans(N);
for(int i=0;i<N;i++){
int number=x[i];
int power=0;
int bit=0;
while(number%2==0){
power++;
number/=2;
}
bit=(number==3)? 0 : 1;
ans[power]=bit;
}
for(int i=0;i<N;i++){
output(ans[i]);
}
}