Submission #431401

#TimeUsernameProblemLanguageResultExecution timeMemory
431401Bench0310Combo (IOI18_combo)C++17
100 / 100
66 ms592 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;
typedef long long ll;

string guess_sequence(int n)
{
    string res;
    int t=press("AB");
    if(t>=1) res+="BA"[press("A")];
    else res+="YX"[press("X")];
    if(n==1) return res;
    string opt=res;
    for(char c:"ABXY") if(c!=res[0]) opt+=c;
    for(int i=2;i<=n-1;i++)
    {
        string now;
        now+=res;
        now+=opt[1];
        for(int j=1;j<=3;j++) now+=(res+opt[2]+opt[j]);
        t=press(now);
        if(t==i-1) res+=opt[3];
        else if(t==i) res+=opt[1];
        else res+=opt[2];
    }
    for(int j=1;j<=3;j++)
    {
        if(j==3||press(res+opt[j])==n)
        {
            res+=opt[j];
            break;
        }
    }
    return res;
}

//int main()
//{
//    guess_sequence(3);
//    return 0;
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...