제출 #783192

#제출 시각아이디문제언어결과실행 시간메모리
783192Mouad_ouj콤보 (IOI18_combo)C++17
100 / 100
25 ms524 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
    string tab[4]={"A","B","X","Y"};
    int c=0,c1=0;
    string ans="";
    if(press(tab[1]+tab[0])!=0)
    {
        if(press(tab[0])==1)
            c=0;
        else
            c=1;
    }
    else
    {
        if(press(tab[2])==1)
            c=2;
        else
            c=3;   
    }
    ans+=tab[c];
    string ntab[3];
    for(int x=0;x<4;x++)
    {
        if(x!=c)
        {
            ntab[c1]=tab[x];
            c1++;
        }
    }
    if(n==1)return ans;
    int ca=0;
    for(int y=1;y<n-1;y++)
    {
        string cur=ans+ntab[2]+ans+ntab[1]+ntab[1]+ans+ntab[1]+ntab[2]+ans+ntab[1]+ntab[0];
        ca=press(cur);
        if(ca==y)
            ans+=ntab[0];
        else if(ca==y+1)
            ans+=ntab[2];
        else
            ans+=ntab[1];
    }
    if(press(ans+ntab[0])==n)
    ans+=ntab[0];
    else if(press(ans+ntab[1])==n)
    ans+=ntab[1];
    else 
    ans+=ntab[2];
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...