Submission #775584

#TimeUsernameProblemLanguageResultExecution timeMemory
7755841binCombo (IOI18_combo)C++14
0 / 100
13 ms256 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
string str;
int x;

string guess_sequence(int n){
    x = press("AB");
    string S;
    if(x){
        x = press("A");
        S = x ? "A" : "B";
    }
    else{
        x = press("X");
        S = x ? "X" : "Y";
    }
    if(n == 1) return S;
    
    for(auto c : "ABXY")
        if(c != S[0]) str += c;
    
    for(int i = 1; i < n - 1; i++){
        string s = S + str[0] + S + str[1] + str[0] + S + str[1] + str[1] + S + str[1] + str[2];
        x = press(s);
        if(x == i) S += str[2];
        else if(x == i + 1) S += str[0];
        else str += str[1];
    }
    x = press(S + str[0]);
    if(x == n) S += str[0]; 
    else{
        x = press(S + str[1]);
        if(x == n) S += str[1];
        else S += str[2];
    }
    return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...