Submission #234041

#TimeUsernameProblemLanguageResultExecution timeMemory
234041BinyominCombo (IOI18_combo)C++14
10 / 100
85 ms576 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std ;

string guess_sequence(int N) {
    vector < char > a = { 'A', 'B', 'X', 'Y' } ;
    char x ;
    string ans = "", p = "";
    int cnt = 1, ok = 1 ;

    if( press("AB") ) {
        if( press("A") ) {
            ok =1 ;
            ans ="A";
            x = 'A';
        }
        else {
            ok =1 ;
            ans ="B";
            x = 'B';
        }
    }
    else {
        if( press("X") ) {
            ok =1 ;
            ans ="X";
            x = 'X';
        }
        else{
            ok =1 ;
            ans ="Y";
            x = 'Y';
        }
    }

    while( cnt != N ) {
        for( int i = 0 ; i < 4 ; i ++ ) {
            if( ok && x == a[i] ) continue ;
            p = ans + a[i] ;
            int tt = press( p );
            if( tt > cnt ) {
                cnt ++ ;
                ans += a[i] ;
                break ;
            }

        }
    }

    return ans ;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...