제출 #1239001

#제출 시각아이디문제언어결과실행 시간메모리
1239001Timosh콤보 (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include "bits/stdc++.h"
#include "combo.h"

using namespace std;

string guess_sequence(int N)
{
  string S, s = "ABXY";
  if (press("AB"))
  {
    if (press("A"))
      S = "A";
    else
      S = "B";
  }
  else
  {
    if (press("X"))
      S = "X";
    else
      S = "Y";
  }
  int j = 0;
  while (S[0] != s[j])
    j++;
  s.erase(s.begin() + j);
  string a, b, c, d;
  a += s[0];
  b += s[1];
  c += s[1];
  d += s[1];
  b += s[0];
  c += s[1];
  d += s[2];
  while (S.size() < N - 1)
  {
    string T = (S + a) + (S + b) + (S + c) + (S + d);
    // cout << T;
    int x = press(T);
    if (x == S.size())
      S += s[2];
    else if (x == S.size() + 1)
      S += s[0];
    else
      S += s[1];
  }
  a = b = c = S;
  a += s[0];
  b += s[1];
  c += s[2];
  if (press(a) == N)
    return a;
  else if (press(b) == N)
    return b;
  else
    return c;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...