Submission #580173

# Submission time Handle Problem Language Result Execution time Memory
580173 2022-06-20T16:49:18 Z Elias Flight to the Ford (BOI22_communication) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#ifndef _DEBUG
#include "communication.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#endif

using namespace std;

int len = 10;
vector<int> numbers = {69, 343, 420};

#ifdef _DEBUG

void send(int x)
{
}

int recieve()
{
}

#endif

void encode(int N, int X)
{
    int number = numbers[X];

    for (int i = 0; i < len; i++)
        send(number & (1 << i));
}

pair<int, int> decode(int N)
{
    int number = 0;

    for (int i = 0; i < len; i++)
    {
        number |= recieve() << i;
    }

    vector<int> pos;

    for (int b = 0; b < (1 << len); b++)
    {
        bool valid = true;

        for (int i = 2; i < len; i++)
            if (b & (1 << i) && b & (1 << (i - 1)))
                valid = false;

        bool newNum = number ^ b;

        for (int i = 0; i < 3; i++)
            if (newNum == numbers[i])
                pos.push_back(i);
    }

    while (pos.size() < 2)
        pos.push_back(0);

    return {pos[0], pos[1]};
}

Compilation message

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:41:19: error: 'recieve' was not declared in this scope; did you mean 'receive'?
   41 |         number |= recieve() << i;
      |                   ^~~~~~~
      |                   receive