Submission #521211

#TimeUsernameProblemLanguageResultExecution timeMemory
521211krit3379Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define N 305

string guess_sequence(int n){
    int i,j,cnt;
    string s,t;
    if(press("AB")){
        if(press("A"))s="A";
        else s="B";
    }
    else{
        if(press("X"))s="X";
        else s="Y";
    }
    if(s!="A")t+="A";
    if(s!="B")t+="B";
    if(s!="X")t+="X";
    if(s!="Y")t+="Y";
    for(i=2;i<n;i++){
        string temp=s;
        for(j=0;j<3;j++){
            temp+=t[0];
            temp+=t[j];
            temp+=s;
        }
        temp+=t[1];
        cnt=press(temp);
        if(cnt==i+1)s+=t[0];
        else if(cnt==i)s+=t[1];
        else s+=t[2];
    }
    if(press(s+t[0]+s+t[1])==n){
        if(press(s+t[0])==n)return s+t[0];
        return s+t[1];
    }
    else return s+t[2];
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:8: error: 'press' was not declared in this scope
    8 |     if(press("AB")){
      |        ^~~~~
combo.cpp:28:13: error: 'press' was not declared in this scope
   28 |         cnt=press(temp);
      |             ^~~~~
combo.cpp:33:8: error: 'press' was not declared in this scope
   33 |     if(press(s+t[0]+s+t[1])==n){
      |        ^~~~~
combo.cpp:7:12: warning: control reaches end of non-void function [-Wreturn-type]
    7 |     string s,t;
      |            ^