제출 #1303311

#제출 시각아이디문제언어결과실행 시간메모리
1303311yus1f_mCombo (IOI18_combo)C++20
10 / 100
20 ms436 KiB
//pragma GCC optimize("O3")
//#include <bits/stdc++.H>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
    int num;
    string ans;
    num=press("AB");
    if(num==2)
    {
        ans="AB";
    }
    else
    {
        if(num==1)
        {
            num=press("A");
            if(num==1)
            {
                ans='A';
            }
            else
            {
                ans='B';
            }
        }
        else
        {
            num=press("X");
            if(num==1)
            {
                ans='X';
            }
            else
            {
                ans='Y';
            }
        }
    }
    while(ans.size()!=n)
    {
        num=press(ans+'A');
        if(num==ans.size()+1)
        {
            ans+='A';
        }
        else
        {
            num=press(ans+'B');
            if(num==ans.size()+1)
            {
                ans+='B';
            }
            else
            {
                num=press(ans+'X');
                if(num==ans.size()+1)
                {
                    ans+='X';
                }
                else
                {
                    ans+='Y';
                }
            }
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...