제출 #742227

#제출 시각아이디문제언어결과실행 시간메모리
742227Rafi22Combo (IOI18_combo)C++14
30 / 100
39 ms468 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

string guess_sequence(int n)
{
    string ans="";
    if(press("AB"))
    {
        if(press("A")) ans+='A';
        else ans+='B';
    }
    else
    {
        if(press("X")) ans+='X';
        else ans+='Y';
    }
    vector<char>V1={'A','B','X','Y'},V;
    for(auto x:V1) if(x!=ans[0]) V.pb(x);
    bool is=0;
    for(int i=2;i<=n;i++)
    {
        if(is)
        {
            if(press(ans+V[0])==i) ans+=V[0];
            else ans+=V[1];
            is=0;
        }
        else
        {
            int k=press(ans+V[0]+V[2]+ans+V[1]+V[2]);
            if(k<i) ans+=V[2];
            else if(k==i)
            {
                if(press(ans+V[0])==i) ans+=V[0];
                else ans+=V[1];
                is=1;
            }
            else
            {
                if(press(ans+V[0])==i) ans+=V[0];
                else ans+=V[1];
                ans+=V[2];
                i++;
            }
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...