Submission #1364555

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

string guess_sequence(int N){
    char first;
    if(press("AB") > 0) {
        if(press("A") > 0) {
            first = 'A';
        }
        else {
            first = 'B';
        }
    }
    else {
        if(press("X") > 0){
            first = 'X';
        }
        else{
            first = 'Y';
        }
    }

    string curpref ;
    curpref += first;
    vector<char> not_first;

    if(first != 'A'){
        not_first.push_back('A');
    }
    if(first != 'B'){
        not_first.push_back('B');
    }
    if(first != 'X'){
        not_first.push_back('X');
    }
    if(first != 'Y'){
        not_first.push_back('Y');
    }

    for(int pos = 2; pos <= N - 1; pos++){
        
        //return pos if it is 0
        string ask = curpref;
        ask += not_first[0];

        //return pos + 1 if it is 1
        ask += curpref;
        ask += not_first[1];
        ask += not_first[2];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[1];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[0];

        //return pos - 1 if it is 2

        if(press(ask) == pos){
            curpref += not_first[0];
        }
        else if(press(ask) == pos + 1){
            curpref += not_first[1];
        }
        else {
            curpref += not_first[2];
        }
    }

    if(press(curpref + not_first[0]) == N) {
        curpref += not_first[0];
    }
    else if(press(curpref + not_first[1]) == N) {
        curpref += not_first[1];
    }
    else {
        curpref += not_first[2];
    }

    return curpref;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:8: error: 'press' was not declared in this scope
    6 |     if(press("AB") > 0) {
      |        ^~~~~
combo.cpp:59:12: error: 'press' was not declared in this scope
   59 |         if(press(ask) == pos){
      |            ^~~~~
combo.cpp:70:8: error: 'press' was not declared in this scope
   70 |     if(press(curpref + not_first[0]) == N) {
      |        ^~~~~