Submission #614259

# Submission time Handle Problem Language Result Execution time Memory
614259 2022-07-31T00:11:17 Z Plurm Flight to the Ford (BOI22_communication) C++17
Compilation error
0 ms 0 KB
#include "communication.h"
#include <bits/stdc++.h>
using namespace std;

void sentbit(int bit) {
  for (int i = 0; i < 100; i++)
    send(bit);
}

void encode(int N, int X) {
  // N = 3
  if (X == 2)
    sendbit(1);
  else
    sendbit(0);
}

int recbit() {
  int cnt[2];
  cnt[0] = cnt[1] = 0;
  for (int i = 0; i < 100; i++) {
    cnt[receive()]++;
  }
  return cnt[0] > cnt[1] ? 0 : 1;
}

std::pair<int, int> decode(int N) { return {1, (recbit() ? 2 : 3)}; }

Compilation message

communication.cpp: In function 'void encode(int, int)':
communication.cpp:13:5: error: 'sendbit' was not declared in this scope; did you mean 'sentbit'?
   13 |     sendbit(1);
      |     ^~~~~~~
      |     sentbit
communication.cpp:15:5: error: 'sendbit' was not declared in this scope; did you mean 'sentbit'?
   15 |     sendbit(0);
      |     ^~~~~~~
      |     sentbit