Submission #1161938

#TimeUsernameProblemLanguageResultExecution timeMemory
1161938tsengangCombo (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
const int mod = 998244353;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

string guess_sequence(int n) {
    string s = "";
    vector<char> chr = {'A', 'B', 'X', 'Y'};
    
    if (press("AB") > 0) {
        if (press("A") > 0) {
            s += 'A';
            chr.erase(remove(all(chr), 'A'), chr.end());
        } else {
            s += 'B';
            chr.erase(remove(all(chr), 'B'), chr.end());
        }
    } else {
        if (press("X") > 0) {
            s += 'X';
            chr.erase(remove(all(chr), 'X'), chr.end());
        } else {
            s += 'Y';
            chr.erase(remove(all(chr), 'Y'), chr.end());
        }
    }

    for (int i = 1; i < n - 1; i++) {
        string t = s + chr[0] + chr[0] + s + chr[0] + chr[1] + s + chr[0] + chr[2] + s + chr[1];
        int x = press(t);
        if (x == i + 2) {
            s += chr[0];
        } else if (x == i + 1) {
            s += chr[1];
        } else {
            s += chr[2];
        }
    }

    if (press(s + chr[0]) == n) {
        s += chr[0];
    } else if (press(s + chr[1]) == n) {
        s += chr[1];
    } else {
        s += chr[2];
    }

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