제출 #783149

#제출 시각아이디문제언어결과실행 시간메모리
783149Mouad_oujCombo (IOI18_combo)C++17
30 / 100
36 ms568 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="";
    for(int x=0;x<3;x++)
    {
        if(press(tab[x])==1)
        {
            c=x;
            break;
        }
        if(c==0 && x==2)
        c=x+1;
    }
    ans+=tab[c];
    string ntab[3];
    for(int x=0;x<4;x++)
    {
        if(x!=c)
        {
            ntab[c1]=tab[x];
            c1++;
        }
    }
    for(int y=1;y<n;y++)
    {
        for(int x=0;x<2;x++)
        {
            if(press(ans+ntab[x])==y+1)
            {
                ans+=ntab[x];
                break;
            }
            if(x==1)
                ans+=ntab[x+1];
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...