# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
347512 | daniel920712 | Parrots (IOI11_parrots) | C++14 | 10 ms | 1532 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"
#include <vector>
#include <algorithm>
using namespace std;
void encode(int N, int M[])
{
vector < int > a,b;
vector < int > all;
int i,j,now=0,x=0,y=0,K;
b.push_back(0);
b.push_back(0);
b.push_back(0);
b.push_back(0);
for(i=0;i<N;i++) for(j=7;j>=0;j--) all.push_back(M[i]&(1<<j));
K=all.size();
for(i=0;i<K;i++)
{
if(all[i]) for(j=0;j<1<<(i/256);j++) a.push_back(i%256);
else for(j=0;j<1<<(i/256);j++) b.push_back(i%256);
}
if(a.size()<b.size()) for(auto i:a) send(i);
else for(auto i:b) send(i);
}
#include "decoder.h"
#include "decoderlib.h"
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
void decode(int N, int L, int X[])
{
vector < int > all;
map < int , int > con;
int ans[605];
int i,j,ok=0,tt;
for(i=0; i<L; i++) con[X[i]]++;
for(auto i:con) if(i.second&4) ok=1;
for(i=0;i<8*N;i++) ans[i]=ok;
for(auto i:con)
{
if(i.second&2) ans[i.first+256]=1-ok;
if(i.second&1) ans[i.first]=1-ok;
}
for(i=0;i<N;i++)
{
tt=0;
for(j=0;j<8;j++) tt+=(1<<(7-j))*ans[8*i+j];
//printf("%d\n",tt);
output(tt);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |