제출 #1002490

#제출 시각아이디문제언어결과실행 시간메모리
1002490fryingduc콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;

const int maxn = 2005;
const char buttons[] = {'A', 'B', 'X', 'Y'};
//int press(string s) {
//    cout << "? " << s << endl;
//    int x; cin >> x;
//    return x;
//}
string guess_sequence(int n) {
    string ans;
    string s;
    char ft = 'A';
    for(int i = 0; i < 4; ++i) {
        s = "";
        s += buttons[i];
        int x = press(s);
        if(x) {
            ft = buttons[i];
            break;
        } 
    }
    ans += ft;
    for(int i = 1; i < n; ++i) {
        for(int j = 0; j < 4; ++j) {
            if(buttons[j] == ft) continue;
            s = ans + buttons[j];
            if(press(s) > (int)ans.size()) {
                ans = s;
                break;
            }
        }
    }
    return ans;
}
//void solve() {
//    cin >> n;
//    cout << guess_sequence(n);
//}
//signed main() {
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    
//    solve();
//    return 0;
//}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:17: error: 'press' was not declared in this scope
   18 |         int x = press(s);
      |                 ^~~~~
combo.cpp:29:16: error: 'press' was not declared in this scope
   29 |             if(press(s) > (int)ans.size()) {
      |                ^~~~~