Submission #529505

#TimeUsernameProblemLanguageResultExecution timeMemory
529505sunnatCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h"
using namespace std;

string guess_sequence(int n){
    string s;
    if(press("AB")){
        if(press("A")) s = "A";
        else s = "B";
    }
    else{
        if(press("X")) s = "X";
        else s = "Y";
    }
    
    string b, x, y;
    
    switch(s[0]){
        case 'A': b = "B", x = "X", y = "Y"; break;
        case 'B': b = "A", x = "X", y = "Y"; break;
        case 'X': b = "B", x = "A", y = "Y"; break;
        case 'Y': b = "B", x = "X", y = "A"; break;
    }
    int l = 1, L;
    for(int i = 1; i < n; i ++){
        L = press(s+b+b+s+b+x+s+b+y+s+x);
        switch(L - l){
            case 0: s.push_back(y[0]); break;
            case 1: s.push_back(x[0]); break;
            case 2: s.push_back(b[0]); break;
        }
    }
    
    return s;
}

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