제출 #873605

#제출 시각아이디문제언어결과실행 시간메모리
873605maxFedorchuk콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
//#include <bits/stdc++.h>
//using namespace std;

/*
int press(string p)
{
    return 1;
}
*/

string guess_sequence(int N)
{
    string alsym[4]={"a","b","x","y"};

    string pot[3];
    int frs;

    if(press(alsym[0]+alsym[1]))
    {
        if(press(alsym[0]))
        {
            frs=0;
            pot[0]="b";
            pot[1]="x";
            pot[2]="y";
        }
        else
        {
            frs=1;
            pot[0]="a";
            pot[1]="x";
            pot[2]="y";
        }
    }
    else
    {
        if(press(alsym[2]))
        {
            frs=2;
            pot[0]="a";
            pot[1]="b";
            pot[2]="y";
        }
        else
        {
            frs=3;
            pot[0]="a";
            pot[1]="b";
            pot[2]="x";
        }
    }

    string res=alsym[frs];

    for(int i=2;i<N;i++)
    {
        string zap=(res+pot[0]+pot[1])+(res+pot[0]+pot[2])+(res+pot[0]+pot[3])+(res+pot[1]+alsym[frs]);

        int rt=press(zap);

        if((res.size()+2)==rt)
        {
            res+=pot[0];
        }
        else
        {
            if((res.size()+1)==rt)
            {
                res+=pot[1];
            }
            else
            {
                res+=pot[2];
            }
        }
    }

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

    return res;
}
/*
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    string s;
    cin>>s;

    if(guess_sequence(s.size())==s)
    {
        cout<<"Ok\n";
    }
    else
    {
        cout<<"No\n";
    }

    return 0;
}
*/

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp:11:1: error: 'string' does not name a type
   11 | string guess_sequence(int N)
      | ^~~~~~