Submission #95570

#TimeUsernameProblemLanguageResultExecution timeMemory
95570dantoh000Combo (IOI18_combo)C++14
0 / 100
1 ms256 KiB
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"

string guess_sequence(int N) {
    char firstletter;
    string S = "";
    string p = "";
    char choices[3];
    if (press("AB") > 1){
        if (press("A") == 1){
            firstletter = 'A';
        }
        else firstletter = 'B';
    }
    else {
        if (press("X") == 1){
            firstletter = 'X';
        }
        else firstletter = 'Y';
    }
    int cur = 0;
    if (firstletter != 'A') choices[cur++] = 'A';
    if (firstletter != 'B') choices[cur++] = 'B';
    if (firstletter != 'X') choices[cur++] = 'X';
    if (firstletter != 'Y') choices[cur++] = 'Y';
    S += firstletter;
    int curscore = 1;
    for (int i = 1; i < N-1; ++i) {
        p = S+choices[0] + choices[0] + S+choices[0]+choices[1]+S+choices[0]+choices[2]+S+choices[1];
        //cout << "guessing " << p << " size of " << N << " " << p.length() << endl;
        int score = press(p);
        if (score == curscore){
            S += choices[2];
        }
        else if (score == curscore+1){
            S += choices[1];
        }
        else {
            S += choices[0];
        }
        curscore++;
    }
    p = S+choices[0] + S+choices[1];
    if (press(p) == N){
        p = S+choices[0];
        if (press(p) == N){
            S += choices[0];
        }
        else S += choices[1];
    }
    else S += choices[2];
    return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...