제출 #1002425

#제출 시각아이디문제언어결과실행 시간메모리
1002425zh_h콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define lint long long #define pb push_back #define mp make_pair using namespace std; // int press(string p){ // int temp; // cin >> temp; // return temp; // } string guess_sequence(int n){ string one, two, three; string ans; //* find first letter if(press("AB") == 1){ if(press("B") == 1){ans = "B"; one = "A"; two = "X"; three = "Y";} else{ans = "A"; one = "B"; two = "X"; three = "Y";} if(press("X") == 1){ans = "X"; one = "A"; two = "B"; three = "Y";} else{ans = "Y"; one = "A"; two = "B"; three = "X";} } int cur = 1; while(cur < n-1){ int temp = press(ans+one + ans+two+one + ans+two+two + ans+two+three); if(temp == cur){ans+=three;} else if(temp == cur+1){ans+=one;} else{ans+=two;} cur++; } if(press(ans+one + ans+two) == n){ if(press(ans+one) == n){return ans+one;} else return ans+two; } else return ans+three; } // int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); // return 0; // }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:8: error: 'press' was not declared in this scope
   19 |     if(press("AB") == 1){
      |        ^~~~~
combo.cpp:28:20: error: 'press' was not declared in this scope
   28 |         int temp = press(ans+one + ans+two+one + ans+two+two + ans+two+three);
      |                    ^~~~~
combo.cpp:37:8: error: 'press' was not declared in this scope
   37 |     if(press(ans+one + ans+two) == n){
      |        ^~~~~
combo.cpp:14:12: warning: control reaches end of non-void function [-Wreturn-type]
   14 |     string one, two, three;
      |            ^~~