제출 #763096

#제출 시각아이디문제언어결과실행 시간메모리
763096t6twotwo콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h"
using namespace std;
string a[] = {"A", "B", "X", "Y"};
std::string guess_sequence(int N) {
    int f = 0;
    if (press("AB")) {
        f = press("B");
    } else {
        f = press("Y") + 2;
    }
    string ans = a[f];
    string x = a[f == 0 ? 1 : 0];
    string y = a[f <= 1 ? 2 : 1];
    string z = a[f == 3 ? 2 : 3];
    for (int i = 1; i < N - 1; i++) {
        int t = press(ans + x + ans + y + x + ans + y + y + ans + y + z);
        if (t == i + 1) {
            ans = ans + x;
        } else if (t == i + 2) {
            ans = ans + y;
        } else {
            ans = ans + z;
        }
    }
    if (press(ans + x) == N) {
        ans = ans + x;
    } else if (press(ans + y) == N) {
        ans = ans + y;
    } else {
        ans = ans + z;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...