Submission #234140

#TimeUsernameProblemLanguageResultExecution timeMemory
234140BinyominCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
//#include "combo.h"

using namespace std ;

string guess_sequence(int N) {
    vector < char >  s, a = { 'A', 'B', 'X', 'Y' } ;
    char x ;
    string ans = "", p = "";
    int cnt = 1, ok = 1, cc;

    if( press("AB") ) {
        if( press("A") ) {
            ok =1 ;
            ans ="A";
            x = 'A';
            s = { 'B', 'X', 'Y'  } ;
        }
        else {
            ok =1 ;
            ans ="B";
            x = 'B';
            s = {'A', 'X', 'Y' };
        }
    }
    else {
        if( press("X") ) {
            ok =1 ;
            ans ="X";
            x = 'X';
            s = {'A', 'B', 'Y' };
        }
        else{
            ok =1 ;
            ans ="Y";
            x = 'Y';
            s = {'A', 'B', 'X'};
        }
    }

    while( cnt != N ) {
        p = ans + s[0] + ans + s[1] + ans + s[1] ;
        cc = press(p) ;
        if( cc == cnt + 2 ) {
            cnt ++ ;
            ans += s[1] ;
        }
        else if( cc == cnt + 1 ) {
            cnt ++ ;
            ans += s[0] ;
        }
        else {
            cnt ++ ;
            ans += s[2] ;
        }
    }

    return ans ;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: error: 'press' was not declared in this scope
   12 |     if( press("AB") ) {
      |         ^~~~~
combo.cpp:43:14: error: 'press' was not declared in this scope
   43 |         cc = press(p) ;
      |              ^~~~~