Submission #1011167

#TimeUsernameProblemLanguageResultExecution timeMemory
1011167AlgorithmWarrior콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N)
{
    string ans="";
    char ch1,ch2,ch3,ch4;
    if(press("AB"))
    {
        if(press("A"))
        {
            ch1='A';
            ch2='B';
            ch3='X';
            ch4='Y';
        }
        else
        {
            ch1='B';
            ch2='A';
            ch3='X';
            ch4='Y';
        }
    }
    else
    {
        if(press("X"))
        {
            ch1='X';
            ch2='A';
            ch3='B';
            ch4='Y';
        }
        else
        {
            ch1='Y';
            ch2='A';
            ch3='B';
            ch4='X';
        }
    }
    ans+=ch1;
    int i;
    for(i=2;i<N;++i)
    {
        int val=press(ans+ch3+ans+ch4+ch2+ans+ch4+ch3+ans+ch4+ch4);
        if(val==i-1)
            ans+=ch2;
        if(val==i)
            ans+=ch3;
        if(val==i+1)
            ans+=ch4;
    }
    if(press(ans+ch2)==N) return ans+ch2;
    if(press(ans+ch3)==N) return ans+ch3;
    return ans+ch4;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press("AB"))
      |        ^~~~~
combo.cpp:47:17: error: 'press' was not declared in this scope
   47 |         int val=press(ans+ch3+ans+ch4+ch2+ans+ch4+ch3+ans+ch4+ch4);
      |                 ^~~~~
combo.cpp:55:8: error: 'press' was not declared in this scope
   55 |     if(press(ans+ch2)==N) return ans+ch2;
      |        ^~~~~
combo.cpp:56:8: error: 'press' was not declared in this scope
   56 |     if(press(ans+ch3)==N) return ans+ch3;
      |        ^~~~~