# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60100 | theknife2001 | 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 "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
for(int i=0;i<N;i++)
{
for(int j=0;j<8;j++)
{
if(M[i]&(1<<j))
{
if(i>15)
send(j+i*10);
send(j+i*10);
}
}
}
}
/*
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
int m[N];
int n=N;
for(int i=0;i<n;i++)
m[i]=M[i];
sort(m,m+n);
int ind;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(M[j]==m[i])
{
ind=j;
M[j]=-1;
}
}
for(int j=0;j<8;j++)
{
if(m[i]&(1<<j))
{
send(j+ind*10);
}
}
}
}
*/
#include "decoder.h"
#include "decoderlib.h"
#include <algorithm>
#include <iostream>
using namespace std;
map < int > mp;
void decode(int N, int L, int X[])
{
int a[260];
for(int i=0;i<N;i++)
a[i]=0;
int x;
for(int i=0;i<L;i++)
mp[X[i]]++;
int f,s;
for(auto m:mp)
{
f=m->first;
s=m->second;
if(f!=0)
{
x=f%10;
f/=10;
}
else
f=0;
if(s>1)
{
a[f+16]+=(1<<x);
s-=2;
}
if(s==1)
{
a[f]+=(1<<x);
}
}
for(int i=0;i<N;i++)
output(a[i]);
}