Submission #1194599

#TimeUsernameProblemLanguageResultExecution timeMemory
1194599Cebrayil09Combo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h>
using namespace std;

#define pii pair < int , int >
#define eb emplace_back
#define pb push_back
//#define int long long
#define fi first
#define se second

int press(string s);

string guess_sequence(int n) {
    char hrf[4] = {'A','B','X','Y'};
    int say[4] = {0,0,0,0};

    for(int i = 0;i < 4;i++) {
        string s = "";
        for(int j = 1;j <= n;j++) s.pb(hrf[i]);

        say[i] = press(s);
    }

    string s = "";
    for(int i = 1;i <= n;i++) {
        for(int j = 0;j < 4;j++) {
            if(say[j] == 0) continue;

            string test = s;
            test.pb(hrf[j]);

            if(i == 1) {
                if(say[j] == 1) {
                    int c = press(test);
                    if(c == test.size()) {
                        say[j]--;
                        s = test;
                        break;
                    }
                }
                continue;
            }

            int c = press(test);
            if(c == test.size()) {
                say[j]--;
                s = test;
                break;
            }
        }
    }

    return s;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...