Submission #101659

#TimeUsernameProblemLanguageResultExecution timeMemory
101659loliconCombo (IOI18_combo)C++14
100 / 100
54 ms512 KiB
#include "combo.h"
#include<algorithm>
using namespace std;


string guess_sequence(int N){
    string s, c = "ABXY";
    int i, t, coin;
    if(press("AB")){
        if(press("A")) {
            s = "A";
            swap(c[0],c[3]);
        } else {
            s = "B";
            swap(c[1],c[3]);
        }
    } else {
        if(press("X")){
            s = "X";
            swap(c[2],c[3]);
        } else {
            s = "Y";
        }
    } coin = 1;
    if(N == 1)
        return s;
    for(i=1;i<N-1;i++){
        t = press(s+c[0]+s+c[1]+c[0]+s+c[1]+c[1]+s+c[1]+c[2]) - coin;
        if(t == 0){
            s += c[2];
        } else if(t == 1){
            s += c[0];
        } else {
            s += c[1];
        }
        coin++;
    }
    if(press(s+c[0]) == coin+1) s += c[0];
    else if(press(s+c[1]) == coin+1) s += c[1];
    else s += c[2];
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...