제출 #756172

#제출 시각아이디문제언어결과실행 시간메모리
756172thinknoexitCombo (IOI18_combo)C++17
100 / 100
31 ms652 KiB
#include "combo.h"
#include <iostream>
using namespace std;
string guess_sequence(int N) {
  string ans, p;
  if (press("AB")) {
    if (press("A")) ans = "A", p = "BXY";
    else ans = "B", p = "AXY";
  }
  else {
    if (press("X")) ans = "X", p = "ABY";
    else ans = "Y", p = "ABX";
  }
  if (N == 1) {
    return ans;
  }
  while ((int)ans.size() < N - 1) {
    int t = press(ans + p[0] + ans + p[1] + p[0] + ans + p[1] + p[1] + ans + p[1] + p[2]);
    if ((int)ans.size() == t - 1) ans += p[0];
    else if ((int)ans.size() == t - 2) ans += p[1];
    else ans += p[2];
  }
  if ((int)ans.size() != press(ans + p[0])) ans += p[0];
  else if ((int)ans.size() != press(ans + p[1])) ans += p[1];
  else ans += p[2];
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...