제출 #568185

#제출 시각아이디문제언어결과실행 시간메모리
568185stevancvCombo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define sp ' ' #define en '\n' using namespace std; const int N = 1e5 + 2; const ll mod = 1e9 + 7; string guess_sequence(int n) { string ans; if (press("AB")) { if (press("A")) ans += 'A'; else ans += 'B'; } else { if (press("X")) ans += 'X'; else ans += 'Y'; } vector<char> v; if (ans[0] != 'A') v.push_back('A'); if (ans[0] != 'B') v.push_back('B'); if (ans[0] != 'X') v.push_back('X'); if (ans[0] != 'Y') v.push_back('Y'); for (int i = 1; i < n; i++) { if (i < n - 1) { string tmp; for (int j = 0; j < 3; j++) { tmp += ans; tmp += v[0]; tmp += v[j]; } tmp += ans; tmp += v[1]; int x = press(tmp); if (x == i + 2) ans += v[0]; else if (x == i + 1) ans += v[1]; else ans += v[2]; } else { string tmp = ans; tmp += v[0]; if (press(tmp) == n) { ans += v[0]; continue; } tmp = ans; tmp += v[1]; if (press(tmp) == n) { ans += v[1]; } else { ans += v[2]; } } } return ans; } /*int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; cout << guess_sequence(n) << en; return 0; } */

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:9: error: 'press' was not declared in this scope
   11 |     if (press("AB")) {
      |         ^~~~~
combo.cpp:34:21: error: 'press' was not declared in this scope
   34 |             int x = press(tmp);
      |                     ^~~~~
combo.cpp:42:17: error: 'press' was not declared in this scope
   42 |             if (press(tmp) == n) {
      |                 ^~~~~
combo.cpp:48:17: error: 'press' was not declared in this scope
   48 |             if (press(tmp) == n) {
      |                 ^~~~~