Submission #287767

#TimeUsernameProblemLanguageResultExecution timeMemory
287767OzyCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define debug(a) cout << #a << " = " << a << endl

string st,prueba;
char a,b,c;
int p,n;

string guess_sequence(int N) {

    n = N;
    prueba = "AB";
    p = press(prueba);
    if (a == 1) {
        p = press("A");
        if(p == 1) st = "A";
        else st = "B";
    }
    else {
        p = press("X");
        if(p == 1) st = "X";
        else st = "Y";
    }

    a = 'A';
    b = 'B';
    c = 'X';
    if (st[0] == 'A') a = 'Y';
    else if (st[0] == 'B') b = 'Y';
    else if (st[0] == 'X') c = 'Y';

    rep(i,2,n-1) {

        prueba = st + b + st + c + a  + st + c + b  + st + c + c ;
        p = press(prueba);

        if (p == i-1) st += a;
        else if (p == i) st += b;
        else st += c;

    }

    prueba = st+a;
    p = press(prueba);
    if (p == n) st += a;
    else {

        prueba = st+b;
        p = press(prueba);
        if (p == n) st += b;
        else st += c;

    }

    return st;

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