Submission #1189884

#TimeUsernameProblemLanguageResultExecution timeMemory
1189884MatteoArcari콤보 (IOI18_combo)C++20
0 / 100
0 ms416 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

int press (string p);

string guess_sequence(int n) {
    srand(time(nullptr));

    vector<int> ord = {0, 1, 2};
    
    string s = "";

    string chars;
    {
        int x = press("AAB");
        int y = press("XXY");
        if (x == 2) { s = "A"; chars = "BXY"; }
        if (x == 1) { s = "B"; chars = "AXY"; }
        if (y == 2) { s = "X"; chars = "ABY"; }
        if (y == 1) { s = "Y"; chars = "ABX"; }
    }

    for (int i = 1; i < n; i++) {
        random_shuffle(ord.begin(), ord.end());
        int x;
        if (i == n - 1) {
            x = press(s + chars[0]);
            if (x == n) { s += chars[0]; break; }
            x = press(s + chars[1]);
            if (x == n) { s += chars[1]; break; }
            s += chars[2]; break;
        }
        
        int cnt = 0;
        for (char j: ord) {
            char c = chars[j];
            x = i + 1;
            if (++cnt < 3) x = press(s + c);
            if (x == i + 1) {
                s += c; break;
            }
        }
    }

    cout << s << endl;

    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...