Submission #1211327

#TimeUsernameProblemLanguageResultExecution timeMemory
1211327lukasuliashviliCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;

std::string guess_sequence(int N) {
    /*A B X Y*/
    string p="";
    string p1="AB";
    int ans=press(p1);
    if (ans==1 or ans==2) {
        string psome="A";
        int ansk=press(psome);
        if (ansk==1) {
            p+=psome;
        }
        else {
            p+="B";
        }

    }
    if (ans==0) {
        string p2="X";
        int ans2=press(p2);
        if (ans2==1) {
            p+=p2;
        }
        else {
            p+="Y";
        }
    }
    string fix1, fix2, fix3;

    if (p[0] == 'X') {
        fix1 = "A";
        fix2 = "B";
        fix3 = "Y";
    }
    if (p[0] == 'Y') {
        fix1 = "A";
        fix2 = "B";
        fix3 = "X";
    }
    if (p[0] == 'A') {
        fix1 = "X";
        fix2 = "B";
        fix3 = "Y";
    }
    if (p[0] == 'B') {
        fix1 = "A";
        fix2 = "X";
        fix3 = "Y";
    }

    while (p.size() < N) {
        string q = p + fix1 + p + fix2 + fix3 + p + fix2 + fix1 + p + fix2 + fix2;
        int res = press(q);
        if (res == p.size()) {
            p += fix3;
        } else if (res == p.size() + 1) {
            p += fix1;
        } else {
            p += fix2;
        }
    }
    return p;


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