제출 #485496

#제출 시각아이디문제언어결과실행 시간메모리
485496Joo콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" /*#include <bits/stdc++.h> using namespace std; int press(string p){ cout << p << "\n"; int x; cin >> x; return x; }*/ string guess_sequence(int N){ string str; vector<char> a = {'A', 'B', 'X', 'Y'}; if(press("AB") == 0){ ///either x or y if(press("X") == 1){ str += 'X'; a.erase(a.begin()+2); }else{ str += 'Y'; a.erase(a.begin()+3); } }else{ ///either a or b if(press("A") == 1){ str += 'A'; a.erase(a.begin()); }else{ str += 'B'; a.erase(a.begin()+1); } } for(int i = 2; i < N; i++){ string tmp = str + a[1] + str + a[2] + a[0] + str + a[2] + a[1] + str + a[2] + a[2]; int res = press(tmp); if(res == str.size()){ ///got nothing new str += a[0]; }else if(res == str.size()+1){ str += a[1]; }else{ str += a[2]; } } if(press(str+a[0]) == N){ str += a[0]; }else if(press(str+a[1]) == N){ str += a[1]; }else{ str += a[2]; } return str; } /* int main(void){ cout << guess_sequence(5) << "\n"; return 0; } */

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

combo.cpp:10:1: error: 'string' does not name a type; did you mean 'stdin'?
   10 | string guess_sequence(int N){
      | ^~~~~~
      | stdin