제출 #335428

#제출 시각아이디문제언어결과실행 시간메모리
335428madlogic콤보 (IOI18_combo)C++17
0 / 100
1 ms220 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int N) {
  string str = "ABXY", ans;
  for (int i = 0; i < 3; i++) {
    string s;
    s += str[i];
    if (press(s)) {
      ans += str[i];
      break;
    }
  }
  if (ans.empty()) {
    ans += str[3];
  }
  string nstr;
  for (char& c : str) {
    if (c != ans[0]) {
      nstr += c;
    }
  }
  str = nstr;
  for (int i = 1; i < N; i++) {
    string checker = ans + nstr[0] + ans + nstr[1] + nstr[0] + ans + nstr[1] +
                     nstr[1] + ans + nstr[1] + nstr[2];
    int res = press(checker);
    if (res == i) {
      ans += nstr[2];
    } else if (res == i + 1) {
      ans += nstr[0];
    } else {
      ans += nstr[1];
    }
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...