Submission #1117921

#TimeUsernameProblemLanguageResultExecution timeMemory
1117921adaawf콤보 (IOI18_combo)C++17
0 / 100
1 ms504 KiB
#include <iostream>
using namespace std;
int press(string s);
char a[] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int n) {
    a[0] = 'A'; a[1] = 'B'; a[2] = 'X'; a[3] = 'Y';
    int h = 0;
    if (press("AB")) {
        if (press("A")) h = 0;
        else h = 1;
    }
    else {
        if (press("X")) h = 2;
        else h = 3;
    }
    swap(a[h], a[3]);
    string s = ""; s += a[3];
    for (int i = 2; i < n; i++) {
        int h = press(s + a[0] + a[0] + s + a[1] + a[0] + s + a[1] + a[1] + s + a[1] + a[2]);
        h -= s.size();
        if (h == 0) s += a[2];
        else if (h == 1) s += a[0];
        else s += a[1];
    }
    if (press(s + a[0]) == n) return s + a[0];
    if (press(s + a[1]) == n) return s + a[1];
    return s + a[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...