제출 #136339

#제출 시각아이디문제언어결과실행 시간메모리
136339quotitquot콤보 (IOI18_combo)C++14
30 / 100
112 ms436 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;

string ans = "";
int ps( char x )
{
    string s = ans;
    s += x;
    return press( s );
}
std::string guess_sequence(int N) {
    string p = "";
    if( press( "AB" ) == 0 )
    {
      if( press( "X" ) == 1 )
        ans = "X";
      else
        ans = "Y";
    }
    else
    {
      if( press( "A" ) == 1 )
        ans = "A";
      else
        ans = "B";
    }
    if( ans == "A" )
        p = "BXY";
    if( ans == "B" )
        p = "AXY";
    if( ans == "X" )
        p = "ABY";
    if( ans == "Y" )
        p = "ABX";
    for( int i = 1; i < N; i ++ )
    {
        if( ps( p[2] ) == i+1 )
            ans += p[2];
        else if( ps( p[1] ) == i+1 )
            ans += p[1];
        else
            ans += p[0];
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...