Submission #701048

#TimeUsernameProblemLanguageResultExecution timeMemory
701048BobCompetitiveProgrammingCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std; using ll=long long;


int press(std::string p);


string guess_sequence(int N){
    string S = "", first, a1, a2, a3;
    if(press("AB")) {
        if(press("A")) first="A", S="A", a1="B", a2="X", a3="Y";
        else first="B", S="B", a1="A", a2="X", a3="Y";
    } else {
        if(press("X")) first="X", S="X", a1="B", a2="A", a3="Y";
        else first="Y", S="Y", a1="B", a2="X", a3="A";
    }

    vector<string> a{a1, a2, a3}; 
        
    while(true){
        int curr_size = S.size();
        if(curr_size == N) 
            return S; 
        
        if(curr_size<N-2){
            ll nxt = press(S+a1+a1 + S+a1+a2 + S+a1+a3 + S+a2) - curr_size; 
            if(nxt==2) S+=a1;
            if(nxt==1) S+=a2;
            if(nxt==0) S+=a3;
        } else {
            if(press(S+a1+S+a2)){
                if(press(S+a1)) S+=a1;
                else S+=a2;
            } else
                s+=a3;
        }
    }   
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:17: error: 's' was not declared in this scope
   35 |                 s+=a3;
      |                 ^