제출 #1206381

#제출 시각아이디문제언어결과실행 시간메모리
1206381isamatdin콤보 (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 p;
  string x;
  if (press("AB"))
    if (press("A"))
      x = "BXY", p = "A";
    else
      x = "AXY", p = "B";
  else if (press("X"))
    x = "ABY", p = "X";
  else
    x = "ABX", p = "Y";
  for (int i = 2; i < n; i++)
  {
    int pref = press(p + x[0] + x[0] + p + x[0] + x[1] + p + x[0] + x[2] + p + x[1]);
    if (pref == i + 1)
    {
      p += x[0];
    }
    else if (pref == i)
    {
      p += x[1];
    }
    else
    {
      p += x[2];
    }
  }
  if (press(p + x[0]) == n)
  {
    p += x[0];
  }
  else if (press(p + x[1]) == n)
  {
    p += x[1];
  }
  else
  {
    p += x[2];
  }
  return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...