제출 #1199501

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

typedef long long ll;
#define FOR(i,N) for(ll i = 0; i < N; i++)
#define all(x) (x).begin(), (x).end()
#define F first 
#define S second

string guess_sequence(int N) {
    string s;
    string buton; // hehe guanhan 🫡
    if (press("AB") >= 1) {
        if (press("A") == 1) {
            s = "A";
            buton = "BXY";
        } else {
            s = "B";
            buton = "AXY";
        }
    } else {
        if (press("X") == 1) {
            s = "X";
            buton = "ABY";
        } else {
            s = "Y";
            buton = "ABX";
        }
    }
    for (int i = 0; i < N-1; i++) {
        int res = press(s+buton[0]  +  s+buton[1]+buton[0]  +  s+buton[1]+buton[1]  +  s+buton[1]+buton[2]);
        if (res == s.size()) s += buton[2];
        if (res == s.size()+1) s += buton[0];
        if (res == s.size()+2) s += buton[1];
    }
    if (press(s+"AB") >= 1) {
        if (press(s+"A") == 1) s += "A";
        else s += "B";
    } else {
        if (press(s+"X") == 1) s += "X";
        else s += "Y";
    }
    return s;
}
// signed main() {
//     cin.tie(0); ios::sync_with_stdio(false);
    
// }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:9: error: 'press' was not declared in this scope
   13 |     if (press("AB") >= 1) {
      |         ^~~~~
combo.cpp:31:19: error: 'press' was not declared in this scope; did you mean 'res'?
   31 |         int res = press(s+buton[0]  +  s+buton[1]+buton[0]  +  s+buton[1]+buton[1]  +  s+buton[1]+buton[2]);
      |                   ^~~~~
      |                   res
combo.cpp:36:9: error: 'press' was not declared in this scope
   36 |     if (press(s+"AB") >= 1) {
      |         ^~~~~