제출 #544561

#제출 시각아이디문제언어결과실행 시간메모리
544561LunaMeme콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long long ll;
#define PB push_back
#define MP make_pair
#define FOR(i, x, y) for (ll i = x; i < y ; i ++)

string guess_sequence(int n){
    string s;
    string l[] = {"A", "B", "X", "Y"};
    string start;
    vector<string> m;
    FOR(i, 0, 4){
        if (press(l[i])) s = l[i];
        else m.PB(l[i]); 
    }
    start = s;
    int num = 1;
    string check = start + m[0] + m[2] + start + m[1] + m[2];
    while (num < n){
        int guess = press(s + check);
        if (guess == 0){
            s += m[2];
            num ++;
        }
        else if (guess == 1){
            if (press(s + m[0])) s += m[0];
            else s += m[1];
            if (press(s + m[0])) s += m[0];
            else s += m[1];
            num += 2;
        }
        else{
            if (press(s + m[0])) s += (m[0] + m[2]);
            else s += (m[1] + m[2]);
            num += 2;
        }
    }
    return s;

}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:13: error: 'press' was not declared in this scope
   17 |         if (press(l[i])) s = l[i];
      |             ^~~~~
combo.cpp:24:21: error: 'press' was not declared in this scope
   24 |         int guess = press(s + check);
      |                     ^~~~~