Submission #1223062

#TimeUsernameProblemLanguageResultExecution timeMemory
1223062madamadam3콤보 (IOI18_combo)C++20
30 / 100
10 ms460 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

using str = string;
str CHARS[4] = {"A", "B", "X", "Y"};

#define rep(x) for (auto &x : CHARS)
#define each(x, a) for (auto &x : a)

str guess_sequence(int N) {
  str fst = "A";
  for (int i = 1; i <= 3; i++) {
    if (press(CHARS[i]) == 1) {
      fst = CHARS[i];
      break;
    }
  }

  vector<string> nchars; for (int i = 0; i < 4; i++) if (CHARS[i] != fst) nchars.push_back(CHARS[i]);
  str pref = fst;

  for (int i = 1; i < N; i++) {
    bool found = false;

    for (int k = 0; k <= 1; k++) {
      if (press(pref + nchars[k]) == pref.size()) continue;
      found = true;
      pref += nchars[k];
      break;
    }

    if (found == false) pref += nchars[2];
  }

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