제출 #1368535

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

using namespace std;

string guess_sequence(int N) {
  string S;
  if (press("AB")) {
    S += (press("A") ? "A" : "B");
  } else {
    S += (press("X") ? "X" : "Y");
  }

  vector<string> C;
  for (string x : {"A", "B", "X", "Y"})
    if (x != S)
      C.push_back(x);

  for (int i = 1; i < N - 1; i++) {
    int r = press(S + C[0] + S + C[1] + C[0] + S + C[1] + C[1] + S + C[1] + C[2]);
    if (r == int(size(S)) + 1)
      S += C[0];
    else if (r == int(size(S)) + 2)
      S += C[1];
    else
      S += C[2];
  }

  if (int(size(S)) < N) {
    if (press(S + "A" + S + "B") == N)
      S += (press(S + "A") == N ? "A" : "B");
    else
      S += (press(S + "X") == N ? "X" : "Y");
  }
  return S;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…