제출 #313268

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

using namespace std;
string guess_sequence(int N) {
  vector<char> ch = {'A', 'B', 'X', 'Y'};
  int x = press("AB");
  string s = "";
  if (x) {
    if (press("A")) {
      s += 'A';
      ch.erase(ch.begin());
    } else {
      s += 'B';
      ch.erase(ch.begin() + 1);
    }
  } else {
    if (press("X")) {
      s += 'X';
      ch.erase(ch.begin() + 2);
    } else {
      s += 'Y';
      ch.erase(ch.begin() + 3);
    }
  }
  for (int i = 2; i < N; ++i) {
    x = press(s + ch[0] + ch[0] + s + ch[0] + ch[1] + s + ch[0] + ch[2] + s + ch[1]);
    if (x >= i + 1) s += ch[0];
    else if (x == i) s += ch[1];
    else s += ch[2];
  }

  if (press(s + ch[0] + s + ch[1]) == N) {
    if (press(s + ch[0]) == N) s += ch[0];
    else s += ch[1];
  } else {
    s += ch[2];
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...