제출 #212258

#제출 시각아이디문제언어결과실행 시간메모리
212258jk89Combo (IOI18_combo)C++14
5 / 100
1 ms328 KiB
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
#include "combo.h"

using namespace std;

#define f first
#define s second

const int MAXN = 2e3 + 3;

string pocz;
bool zab[4];
char who[4] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int n) {
    string ans, temp;
    char spc;
    if (press("A") == 1)
        zab[0] = true;
    else if (press("B") == 1)
        zab[1] = true;
    else if (press("X") == 1)
        zab[2] = true;
    else
        zab[3] = true;
    bool wys = false;
    for (int i = 0; i < 4; i++) {
        if (zab[i]) {
            wys = true;
            spc = who[i];
            continue;
        }
        if (wys)
            swap(who[i - 1], who[i]);
    }
    ans += spc;
    int roz = 1;
    int wyn;
    for (int i = 1; i < n - 1; i++) {
        wyn = press(ans + who[0] + ans + who[1] + who[0] + ans + who[1] + who[1] + ans + who[1] + who[2]);
        if (wyn == roz)
            ans += who[2];
        else if (wyn == roz + 1)
            ans += who[0];
        else
            ans += who[1];
        roz++;
    }
    if (press(ans + who[0]) == roz + 1)
        ans += who[0];
    else if (press(ans + who[1]) == roz + 1)
        ans += who[1];
    else
        ans += who[2];
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...