제출 #742446

#제출 시각아이디문제언어결과실행 시간메모리
742446salmonFlight to the Ford (BOI22_communication)C++17
컴파일 에러
0 ms0 KiB
#include"communication.h" // // --- Sample implementation for the task communication --- // // To compile this program with the sample grader, place: // communication.h communication_sample.cpp sample_grader.cpp // in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory, // left click on "Open in terminal") and enter e.g.: // g++ -std=c++17 communication_sample.cpp sample_grader.cpp // in this folder. This will create a file a.out in the current directory which you can execute from the terminal // as ./a.out // See task statement or sample_grader.cpp for the input specification // void encode(int N, int X) { int v; bool floog; if(X == 1){ send(1); send(1); send(1); } else if(X == 2){ if(send(0) != 0){ send(1); send(0); } else{ send(0); send(1); } } else{ send(0); send(0); send(0); } } std::pair<int, int> decode(int N) { vector<int> v; v.push_back(recieve()); v.push_back(recieve()); v.push_back(recieve()); if(v == {1,1,1}){ return make_pair(1,2); } else if(v == {0,1,1}){ return make_pair(1,2); } else if(v == {0,1,0}){ return make_pair(1,3); } else if(v == {1,0,1}){ return make_pair(1,3); } else if(v == {1,1,0}){ return make_pair(1,2); } else if(v == {0,0,1}){ return make_pair(2,3); } else if(v == {0,0,0}){ return make_pair(2,3); } else{ return make_pair(2,3); } }

컴파일 시 표준 에러 (stderr) 메시지

communication.cpp: In function 'void encode(int, int)':
communication.cpp:15:9: warning: unused variable 'v' [-Wunused-variable]
   15 |     int v;
      |         ^
communication.cpp:16:10: warning: unused variable 'floog' [-Wunused-variable]
   16 |     bool floog;
      |          ^~~~~
communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:43:5: error: 'vector' was not declared in this scope
   43 |     vector<int> v;
      |     ^~~~~~
communication.cpp:43:12: error: expected primary-expression before 'int'
   43 |     vector<int> v;
      |            ^~~
communication.cpp:44:5: error: 'v' was not declared in this scope
   44 |     v.push_back(recieve());
      |     ^
communication.cpp:44:17: error: 'recieve' was not declared in this scope; did you mean 'receive'?
   44 |     v.push_back(recieve());
      |                 ^~~~~~~
      |                 receive
communication.cpp:48:13: error: expected primary-expression before '{' token
   48 |     if(v == {1,1,1}){
      |             ^
communication.cpp:48:12: error: expected ')' before '{' token
   48 |     if(v == {1,1,1}){
      |       ~    ^~
      |            )
communication.cpp:49:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   49 |         return make_pair(1,2);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:51:18: error: expected primary-expression before '{' token
   51 |     else if(v == {0,1,1}){
      |                  ^
communication.cpp:51:17: error: expected ')' before '{' token
   51 |     else if(v == {0,1,1}){
      |            ~    ^~
      |                 )
communication.cpp:52:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   52 |         return make_pair(1,2);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:54:18: error: expected primary-expression before '{' token
   54 |     else if(v == {0,1,0}){
      |                  ^
communication.cpp:54:17: error: expected ')' before '{' token
   54 |     else if(v == {0,1,0}){
      |            ~    ^~
      |                 )
communication.cpp:55:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   55 |         return make_pair(1,3);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:57:18: error: expected primary-expression before '{' token
   57 |     else if(v == {1,0,1}){
      |                  ^
communication.cpp:57:17: error: expected ')' before '{' token
   57 |     else if(v == {1,0,1}){
      |            ~    ^~
      |                 )
communication.cpp:58:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   58 |         return make_pair(1,3);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:60:18: error: expected primary-expression before '{' token
   60 |     else if(v == {1,1,0}){
      |                  ^
communication.cpp:60:17: error: expected ')' before '{' token
   60 |     else if(v == {1,1,0}){
      |            ~    ^~
      |                 )
communication.cpp:61:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   61 |         return make_pair(1,2);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:63:18: error: expected primary-expression before '{' token
   63 |     else if(v == {0,0,1}){
      |                  ^
communication.cpp:63:17: error: expected ')' before '{' token
   63 |     else if(v == {0,0,1}){
      |            ~    ^~
      |                 )
communication.cpp:64:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   64 |         return make_pair(2,3);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:66:18: error: expected primary-expression before '{' token
   66 |     else if(v == {0,0,0}){
      |                  ^
communication.cpp:66:17: error: expected ')' before '{' token
   66 |     else if(v == {0,0,0}){
      |            ~    ^~
      |                 )
communication.cpp:67:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   67 |         return make_pair(2,3);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
communication.cpp:70:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   70 |         return make_pair(2,3);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/10/utility:70,
                 from communication.h:1,
                 from communication.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~