Submission #441547

#TimeUsernameProblemLanguageResultExecution timeMemory
441547impriCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"

std::string guess_sequence(int N) {
	char val[4]={'A','B','X','Y'};
    std::string res="U";
    std::string t="U";
    int first=-1;
    t="AB";
    if(guess(t)){
        t="A";
        if(guess(t)){
            res[0]='A';
            first=0;
        }
        else{
            res[0]='B';
            first=1;
        }
    }
    else{
        t="X";
        if(guess(t)){
            res[0]='X';
            first=2;
        }
        else{
            res[0]='Y';
            first=3;
        }
    }
      
    
   
    if(N==1)return res;
    for(int i=1;i<N-1;i++){
        t=res;
        for(int j=1;j<=3;j++)
        {t+=val[(first+1)%4];t+=val[(first+j)%4];t+=res;}
        t+=val[(first+2)%4];
        int g=press(t);
        if(g==i+2)
            res+=val[(first+1)%4];
        else if(g==i+1)
            res+=val[(first+2)%4];
        else
            res+=val[(first+3)%4];
    }
    if(press(res+val[(first+1)%4])==N)
        res+=val[(first+1)%4];
   else if(press(res+val[(first+2)%4])==N)
        res+=val[(first+2)%4];
   else
        res+=val[(first+3)%4];
   return res;
   
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'guess' was not declared in this scope
    9 |     if(guess(t)){
      |        ^~~~~