Submission #1363032

#TimeUsernameProblemLanguageResultExecution timeMemory
1363032solution6312Friend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include "parrots.h"
#include <iostream>
#include <cassert>
using namespace std;

void send(int x);
void output(int y);

void encode(int N, int A[])
{
    int cnt=0;
    for (int i=0; i<N; i++)
    {
        for (int j=0; j<8; j+=2)
        {
            bool b1=((A[i]>>j)&1), b2=((A[i]>>(j+1))&1);
            int id=i*4+j/2, c=b1*2+b2;
            cnt+=c;
        }
    }
    cerr<<cnt<<endl;
    if (cnt<=N*6)
    {
        for (int i=0; i<N; i++)
        {
            for (int j=0; j<8; j+=2)
            {
                bool b1=((A[i]>>j)&1), b2=((A[i]>>(j+1))&1);
                int id=i*4+j/2, c=b1+b2*2;
                while (c--) send(id);
            }
        }
    }
    else
    {
        send(0); send(0); send(0); send(0);
        for (int i=0; i<N; i++)
        {
            for (int j=0; j<8; j+=2)
            {
                bool b1=((A[i]>>j)&1), b2=((A[i]>>(j+1))&1);
                int id=i*4+j/2, c=b1+b2*2; c=3-c;
                while (c--) send(id);
            }
        }
    }
}
void decode(int N, int L, int B[])
{
    int cnt[256]={0}, ans[N]={0};
    for (int i=0; i<L; i++) cnt[B[i]]++;
    if (cnt[0]<4)
    {
        for (int i=0; i<256; i++)
        {
            int q=i/4, r=i%4; r*=2;
            if (cnt[i]==1) ans[q]^=(1<<r);
            else if (cnt[i]==2) ans[q]^=(1<<(r+1));
            else if (cnt[i]==3)
            {
                ans[q]^=(1<<r);
                ans[q]^=(1<<(r+1));
            }
        }
    }
    else
    {
        cnt[0]-=4;
        for (int i=0; i<256; i++)
        {
            int q=i/4, r=i%4; r*=2;
            if (cnt[i]==2) ans[q]^=(1<<r);
            else if (cnt[i]==1) ans[q]^=(1<<(r+1));
            else if (cnt[i]==0)
            {
                ans[q]^=(1<<r);
                ans[q]^=(1<<(r+1));
            }
        }
    }
    for (int i=0; i<N; i++)
    {
        //cerr<<ans[i]<<' ';
        output(ans[i]);
    } //cerr<<endl;
}

Compilation message (stderr)

friend.cpp:1:10: fatal error: parrots.h: No such file or directory
    1 | #include "parrots.h"
      |          ^~~~~~~~~~~
compilation terminated.