Submission #78860

#TimeUsernameProblemLanguageResultExecution timeMemory
78860renatsjCombo (IOI18_combo)C++14
30 / 100
111 ms596 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
int i,j,n,m;
string s,x;
char a[4];
std::string guess_sequence(int N)
{
    n=N;
    x="";
    if (press("AB")>=1)
    {
        if (press("A")==1)
        {
            a[0]='B';
            a[1]='X';
            a[2]='Y';
            x="A";
        }
        else
        {
            a[0]='A';
            a[1]='X';
            a[2]='Y';
            x="B";
        }
    }
    else if (press("X")==1)
    {
        a[0]='B';
        a[1]='A';
        a[2]='Y';
        x="X";
    }
    else
    {
        a[0]='B';
        a[1]='X';
        a[2]='A';
        x="Y";
    }


    i=1;
    while (i+1<n)
    {
        s=x+a[0]+a[0]+x+a[0]+a[1]+x+a[0]+a[2]+x+a[1];
        if (press(s)>i+1)
        {
            x+=a[0];
        }
        else if (press(s)>i)
        {
            x+=a[1];
        }
        else
        {
            x+=a[2];
        }
        i++;
    }
    while (i<n)
    {
        if (press(x+a[0])>i)
        {
            x+=a[0];
        }
        else if (press(x+a[1])>i)
        {
            x+=a[1];
        }
        else
        {
            x+=a[2];
        }
        i++;
    }
    return x;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...