제출 #1349882

#제출 시각아이디문제언어결과실행 시간메모리
1349882bbbiros콤보 (IOI18_combo)C++20
5 / 100
0 ms344 KiB
#include "combo.h"
#include <iostream>
using namespace std;
int n;
std::string guess_sequence(int N)
{
  n = N;
  string ans;
  char b, x, y;

  if (press("AB") > 0)
  {
    if (press("A") > 0)
    {
      ans = "A";
      b = 'B';
      x = 'X';
      y = 'Y';
    }
    else
    {
      ans = "B";
      b = 'A';
      x = 'X';
      y = 'Y';
    }
  }
  else
  {
    if (press("X") > 0)
    {
      ans = "X";
      b = 'A';
      x = 'B';
      y = 'Y';
    }
    else
    {
      ans = "Y";
      b = 'A';
      x = 'B';
      y = 'X';
    }
  }
  for (int i = 2; i < n; i++)
  {
    int res = press(ans + b + ans + x + b + ans + x + x + ans + x + y);

    if (res == ans.size())
      ans += y;
    else if (res == ans.size() + 1)
      ans += b;
    else
      ans += x;
  }
  if (press(ans + b) == n)
    ans += b;
  else if (press(ans + x) == n)
    ans += x;
  else
    ans += y;
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...