# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900282 | Faisal_Saqib | 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.
#pragma once
#include <map>
#include <iostream>
#include "parrotslib.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)))
{
int l=0;
for(int p=2;p>=0;p--)
{
l*=2;
l+=(((j>>p)&1));
}
for(int p=4;p>=0;p--)
{
l*=2;
l+=((i>>p)&1);
}
send(l);
}
}
}
}
#pragma once
#include <map>
#include <iostream>
#include "parrotslib.h"
using namespace std;
void decode(int n, int l, int x[])
{
map<int,int> cnt;
for(int i=0;i<l;i++)
{
cnt[x[i]]++;
}
for(int i=0;i<n;i++)
{
int an=0;
for(int j=0;j<8;j++)
{
int l=0;
for(int p=2;p>=0;p--)
{
l*=2;
l+=(((j>>p)&1));
}
for(int p=4;p>=0;p--)
{
l*=2;
l+=((i>>p)&1);
}
if(cnt.find(l)!=cnt.end())
{
an+=(1<<j);
}
}
output(an);
}
}