Submission #86952

#TimeUsernameProblemLanguageResultExecution timeMemory
86952AlexPop28Combo (IOI18_combo)C++11
5 / 100
2 ms272 KiB
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'
#include "combo.h"

using namespace std;

typedef pair <int, int> pii;
typedef vector <int> vi;
typedef long long ll;
typedef unsigned long long ull;

string guess_sequence (int N) {
    string p = "", cand = "", s;
    int aux = press ("AB");
    p = press ("AB") ? (press ("A") ? "A" : "B") : (press ("X") ? "X" : "Y");
    for (char c : "ABXY") {
        if (c == p[0]) continue;
        cand += c;
    }

    for (int i = 2; i <= N - 1; ++i) {
        s = p + cand[0] + p + cand[1] + cand[0] + p + cand[1] + cand[1] + p + cand[1] + cand[2];
        aux = press (s);
        if (aux == i - 1) {
            p += cand[2];
        } else if (aux == i) {
            p += cand[0];
        } else {
            p += cand[1];
        }
    }

    for (int i = 0; i < 3; ++i) {
        aux = press (p + cand[i]);
        if (aux == N) return (p + cand[i]);
    }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:16: warning: control reaches end of non-void function [-Wreturn-type]
   17 |     string p = "", cand = "", s;
      |                ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...