Submission #868040

#TimeUsernameProblemLanguageResultExecution timeMemory
868040TAhmed33Flight to the Ford (BOI22_communication)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <communication.h> using namespace std; void encode (int n, int x) { for (int i = 1; i <= x; i++) send(1); for (int i = x + 1; i <= n; i++) send(0); } pair <int, int> decode (int n) { vector <int> u; for (int i = 0; i < 3; i++) u.push_back(receive()); if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) { return {2, 3}; } if (u == {0, 1, 1}) { return {2, 3}; } if (u == {1, 0, 1}) { return {1, 3}; } if (u == {0, 0, 0}) { return {1, 1}; } if (u == {0, 0, 1}) { return {1, 1}; } if (u == {1, 0, 0}) { return {2, 2}; } }

Compilation message (stderr)

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:10:11: error: expected primary-expression before '{' token
   10 |  if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) {
      |           ^
communication.cpp:10:10: error: expected ')' before '{' token
   10 |  if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) {
      |     ~    ^~
      |          )
communication.cpp:13:11: error: expected primary-expression before '{' token
   13 |  if (u == {0, 1, 1}) {
      |           ^
communication.cpp:13:10: error: expected ')' before '{' token
   13 |  if (u == {0, 1, 1}) {
      |     ~    ^~
      |          )
communication.cpp:16:11: error: expected primary-expression before '{' token
   16 |  if (u == {1, 0, 1}) {
      |           ^
communication.cpp:16:10: error: expected ')' before '{' token
   16 |  if (u == {1, 0, 1}) {
      |     ~    ^~
      |          )
communication.cpp:19:11: error: expected primary-expression before '{' token
   19 |  if (u == {0, 0, 0}) {
      |           ^
communication.cpp:19:10: error: expected ')' before '{' token
   19 |  if (u == {0, 0, 0}) {
      |     ~    ^~
      |          )
communication.cpp:22:11: error: expected primary-expression before '{' token
   22 |  if (u == {0, 0, 1}) {
      |           ^
communication.cpp:22:10: error: expected ')' before '{' token
   22 |  if (u == {0, 0, 1}) {
      |     ~    ^~
      |          )
communication.cpp:25:11: error: expected primary-expression before '{' token
   25 |  if (u == {1, 0, 0}) {
      |           ^
communication.cpp:25:10: error: expected ')' before '{' token
   25 |  if (u == {1, 0, 0}) {
      |     ~    ^~
      |          )
communication.cpp:9:15: warning: control reaches end of non-void function [-Wreturn-type]
    9 |  vector <int> u; for (int i = 0; i < 3; i++) u.push_back(receive());
      |               ^