제출 #861616

#제출 시각아이디문제언어결과실행 시간메모리
861616Ariadna콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB

#include <bits/stdc++.h>

using namespace std;

string first_char() {
    string s = "A";
    if (press(s)) return s;
    s = "B";
    if (press(s)) return s;
    s = "X";
    if (press(s)) return s;
    s = "Y";
    return s;
}

string guess_sequence(int N) {
    string s = first_char();
    int l = 1;
    while (l != N) {
        ++l;
        s += "A";
        if (s[0] != 'A' && press(s) == l) continue;
        s[l - 1] = 'B';
        if (s[0] != 'B' && press(s) == l) continue;
        s[l - 1] = 'X';
        if (s[0] != 'X' && press(s) == l) continue;
        s[l - 1] = 'Y';
    }
    return s;
}

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

combo.cpp: In function 'std::string first_char()':
combo.cpp:8:9: error: 'press' was not declared in this scope
    8 |     if (press(s)) return s;
      |         ^~~~~
combo.cpp:10:9: error: 'press' was not declared in this scope
   10 |     if (press(s)) return s;
      |         ^~~~~
combo.cpp:12:9: error: 'press' was not declared in this scope
   12 |     if (press(s)) return s;
      |         ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:28: error: 'press' was not declared in this scope
   23 |         if (s[0] != 'A' && press(s) == l) continue;
      |                            ^~~~~
combo.cpp:25:28: error: 'press' was not declared in this scope
   25 |         if (s[0] != 'B' && press(s) == l) continue;
      |                            ^~~~~
combo.cpp:27:28: error: 'press' was not declared in this scope
   27 |         if (s[0] != 'X' && press(s) == l) continue;
      |                            ^~~~~