Submission #1249300

#TimeUsernameProblemLanguageResultExecution timeMemory
1249300lamlamlamCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

vector<char> c;
string guess_sequence(int n)
{
    string res;
    if(press("AB")){
        if(press("A")) res += 'A';
        else res += 'B';
    }
    else {
        if(press("X")) res += 'X';
        else res += 'Y';
    }
    if(n==1) return res;
    if(res[0]!='A') c.push_back('A');
    if(res[0]!='B') c.push_back('B');
    if(res[0]!='X') c.push_back('X');
    if(res[0]!='Y') c.push_back('Y');
    string cases[4];
    for(int i=0; i<3; i++) cases[i] += c[0], cases[i] += c[i];
    cases[3] += c[1];
    for(int i=1; i<n-1; i++){
        string ask;
        for(int j=0; j<4; j++) ask += res + cases[j];
        int awn = press(ask);
        if(awn==2+i) res += c[0];
        else if(awn==1+i) res += c[1];
        else res += c[2];
    }
    if(press(res+c[0])==n) res += c[0];
    else if(press(res+c[1])==n) res += c[1];
    else res += c[2];
    return res;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:8: error: 'press' was not declared in this scope; did you mean 'res'?
    8 |     if(press("AB")){
      |        ^~~~~
      |        res
combo.cpp:27:19: error: 'press' was not declared in this scope; did you mean 'res'?
   27 |         int awn = press(ask);
      |                   ^~~~~
      |                   res
combo.cpp:32:8: error: 'press' was not declared in this scope; did you mean 'res'?
   32 |     if(press(res+c[0])==n) res += c[0];
      |        ^~~~~
      |        res