Submission #1114549

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

using namespace std;

string guess_sequence(int N) {
    string s="";
    if(press("AB"))
    {
        if(press("A")) s.push_back('A');
        else s.push_back('B');
    }
    else
    {
        if(press("X")) s.push_back('X');
        else s.push_back('Y');
    }
    string can="ABXY";
    if(s[0]=='A') can.erase(0,1);
    else if(s[0]=='B') can.erase(1,1);
    else if(s[0]=='X') can.erase(2,1);
    else can.erase(3,1);
    for(int i=1;i<n;i++)
    {
        string t=s;
        t.push_back(can[0]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[0]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[1]);
        t+=s;
        t.push_back(can[1]);t.push_back(can[2]);
        int c=press(t);
        if(c==i) s.push_back(can[2]);
        else if(c==i+1) s.push_back(can[0]);
        else s.push_back(can[1]);
    }
    return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:19: error: 'n' was not declared in this scope
   22 |     for(int i=1;i<n;i++)
      |                   ^