Submission #282706

#TimeUsernameProblemLanguageResultExecution timeMemory
282706peti1234Combo (IOI18_combo)C++17
100 / 100
39 ms588 KiB
#include <iostream>
#include "combo.h"
using namespace std;
string s;
int x, y;
char a='A', b='B', c='X';
string guess_sequence(int n) {
    x=press("AB");
    y=press("AX");
    if (x && y) s+=a, a='Y';
    if (x && !y) s+=b, b='Y';
    if (!x && y) s+=c, c='Y';
    if (!x && !y) s+='Y';
    for (int i=1; i<n-1; i++) {
        x=press(s+a+a+s+a+b+s+a+c+s+b);
        if (x==i+2) s+=a;
        if (x==i+1) s+=b;
        if (x==i) s+=c;
    }
    if (n>1) {
        x=press(s+a);
        y=press(s+b);
        if (x>y) s+=a;
        if (y>x) s+=b;
        if (x==y) s+=c;
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...