제출 #654466

#제출 시각아이디문제언어결과실행 시간메모리
654466atigunFlight to the Ford (BOI22_communication)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include"communication.h" using namespace std; void encode(int N, int X) { vector<int> v; for(int bit = 0; bit <= 10; 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) { solution = 0; vector<int> v; for(int bit = 0; bit <= 10; 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); }

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

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:18:3: error: 'solution' was not declared in this scope
   18 |   solution = 0;
      |   ^~~~~~~~
communication.cpp:21:10: warning: unused variable 'on' [-Wunused-variable]
   21 |     bool on = 0;
      |          ^~