Submission #82726

#TimeUsernameProblemLanguageResultExecution timeMemory
82726314rateCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;


/**string ans="ABXYY";
int cnt=0;
**/
/**int press(string p)
{
    cnt++;
    int sl=0;
    for(int i=0;i<p.size();i++)
    {
        for(int j=0;j<ans.size() && i+j<p.size();j++)
        {
            ///cout<<i<<"\t"<<ans[j]<<" "<<p[i+j]<<"\n";
            if(ans[j]==p[i+j])
            {
                sl=max(sl,j+1);
            }
            else
            {
                break;
            }
        }
    }
    return sl;
}**/

string guess_sequence(int n)
{
    string sl;
    string ch;
    if(press("AB")!=0)
    {
        if(press("A")!=0)
        {
            ch="BXY";
            sl="A";
        }
        else
        {
            ch="AXY";
            sl="B";
        }
    }
    else
    {
        if(press("X")!=0)
        {
            ch="ABY";
            sl="X";
        }
        else
        {
            ch="ABX";
            sl="Y";
        }
    }
    for(int now=1;now+1<n;now++)
    {
        string q=(sl+ch[2]+ch[0])+(sl+ch[2]+ch[1])+(sl+ch[2]+ch[2])+(sl+ch[1]);
        int value=press(q);
        sl+=ch[value-now];
    }
    if(press(sl+ch[0])==n)
    {
        sl+=ch[0];
    }
    else
    {
        if(press(sl+ch[1])==n)
        {
            sl+=ch[1];
        }
        else
        {
            sl+=ch[2];
        }
    }
    return sl;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:8: error: 'press' was not declared in this scope
   35 |     if(press("AB")!=0)
      |        ^~~~~
combo.cpp:64:19: error: 'press' was not declared in this scope
   64 |         int value=press(q);
      |                   ^~~~~
combo.cpp:67:8: error: 'press' was not declared in this scope
   67 |     if(press(sl+ch[0])==n)
      |        ^~~~~