제출 #937018

#제출 시각아이디문제언어결과실행 시간메모리
937018Khalid_Alabdullatif콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<ll,int>
using namespace std;
string guess_sequence(int n){
    string p;
    char p1,p2,p3;
    if(press("AB")){
        if(press("A"))
            p+='A',p1='B';
        else
            p+='B',p1='A';
        p2='Y',p3='X';
    }
    else{
        if(press("X"))
            p+='X',p3='Y';
        else
            p+='Y',p3='X';
        p1='A',p2='B';
    }
    if(n==1)
        return p;
    int sz=1;
    for(int i=1;i<n-1;i++){
        string tmp=p;
        tmp+=p1+p1,tmp+=p,tmp+=p1+p2,tmp+=p,tmp+=p1+p3,tmp+=p,tmp+=p2;
        int x=press(tmp);
        if(x-sz==2)
            p+=p1;
        else if(x-sz==1)
            p+=p2;
        else
            p+=p3;
        sz=p.size();
    }
    if(press(p+p1)-sz)
        p+=p1;
    else
        p+=(press(p+p2)-sz ? p2:p3);
    return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:8: error: 'press' was not declared in this scope
   10 |     if(press("AB")){
      |        ^~~~~
combo.cpp:30:15: error: 'press' was not declared in this scope
   30 |         int x=press(tmp);
      |               ^~~~~
combo.cpp:39:8: error: 'press' was not declared in this scope
   39 |     if(press(p+p1)-sz)
      |        ^~~~~