Submission #86934

#TimeUsernameProblemLanguageResultExecution timeMemory
86934tjdgus4384Combo (IOI18_combo)C++14
0 / 100
2 ms256 KiB
#include<cstdio>
#include "combo.h"
#include<string>
#include<iostream>
using namespace std;
string x[4] = {"A", "B", "X", "Y"};

string guess_sequence(int n)
{
    int f;
    string ans;
    if(press("AB"))
    {
        if(press("A")) f = 0;
        else f = 1;
    }
    else
    {
        if(press("X")) f = 2;
        else f = 3;
    }
    ans += x[f];
    for(int i = 2;i <= n;i++)
    {
        string a, b, c, d;
        a = b = c = d = x[f];
        int cnt = 0;
        for(int j = 0;j < 4;j++)
        {
            if(j == f) continue;
            if(cnt == 0)
            {
                a += x[j]; a += x[j];
                b += x[j]; c += x[j];
            }
            else if(cnt == 1)
            {
                b += x[j]; d += x[j];
            }
            else c += x[j];
            cnt++;
        }
        string s = a + b + c + d;
        int p = 3 - press(s);
        for(int j = 0;j < 4;j++)
        {
            if(j == f) continue;
            if(cnt == p) {f = j;break;}
        }
        ans += x[f];
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...