Submission #654381

#TimeUsernameProblemLanguageResultExecution timeMemory
654381atigunFlight to the Ford (BOI22_communication)C++17
Compilation error
0 ms0 KiB
#include"communication.h" using namespace std; void encode(int N, int X) { vector<int> v; for(int bit = 0; bit <= 2; bit++){ bool on = (X >> bit)&1; v.push_back(send(on)); v.push_back(send(on)); while(v.end()[-1] != v.end()[-2]) v.push_back(send(on)); } } pair<int, int> decode(int N) { int solution = 0; vector<int> v; for(int bit = 0; bit <= 2; bit++){ bool on = 0; v.push_back(receive()); v.push_back(receive()); while(v.end()[-1] != v.end()[-2]) v.push_back(receive()); if(v.end()[-1]) solution|= (1<<bit); } return make_pair(solution, solution); }

Compilation message (stderr)

communication.cpp: In function 'void encode(int, int)':
communication.cpp:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> v;
      |   ^~~~~~
communication.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include"communication.h"
  +++ |+#include <vector>
    2 | 
communication.cpp:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> v;
      |          ^~~
communication.cpp:9:5: error: 'v' was not declared in this scope
    9 |     v.push_back(send(on));
      |     ^
communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:18:3: error: 'vector' was not declared in this scope
   18 |   vector<int> v;
      |   ^~~~~~
communication.cpp:18:3: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
communication.cpp:18:10: error: expected primary-expression before 'int'
   18 |   vector<int> v;
      |          ^~~
communication.cpp:21:5: error: 'v' was not declared in this scope
   21 |     v.push_back(receive());
      |     ^
communication.cpp:20:10: warning: unused variable 'on' [-Wunused-variable]
   20 |     bool on = 0;
      |          ^~