제출 #529492

#제출 시각아이디문제언어결과실행 시간메모리
529492sunnat콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <stdlib.h>
using namespace std;
string s = "ABXYY";

int main(){
    int n;
    cin >> n;
    string s;
    if(press("AB")){
        if(press("A")) s = "A";
        else s = "B";
    }
    else{
        if(press("X")) s = "X";
        else s = "Y";
    }
    string t;
    for(int i = 0; i < 4; i ++)
        if("ABXY"[i] != s[0]) t.push_back("ABXY"[i]);
    int l = 1;
    for(int i = 1; i < n; i ++)
        s.push_back(t[rand() % 3]);
    int L;
    string nt;
    while(l != n){
        L = press(s);
        if(L == n) break;
        if(L == l) nt.push_back(s[l]);
        else{
            nt = "";
            l = L;
        }
        int x = rand() % (3 - nt.size());
        int y = -1;
        while(x >= 0){
            y ++;
            if(nt.find(t[y]) == string::npos)
                x --;
        }
        s[l] = t[y];
        for(int i = l + 1; i < n; i ++)
            s[i] = t[rand()%3];
    }
    cout << s;
    return 0;
}

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

combo.cpp: In function 'int main()':
combo.cpp:10:8: error: 'press' was not declared in this scope
   10 |     if(press("AB")){
      |        ^~~~~
combo.cpp:27:13: error: 'press' was not declared in this scope
   27 |         L = press(s);
      |             ^~~~~