제출 #1349885

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

  if (press("AB") > 0)
    if (press("A") > 0)
      ans = "A";
    else
      ans = "B";
  else
    if (press("X") > 0)
      ans = "X";
    else
      ans = "Y";
  string all = "ABXY";
  string rem = "";
  for (char c : all)
    if (c != ans[0])
      rem += c;
  b = rem[0];
  x = rem[1];
  y = rem[2];
  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...