Submission #1238994

#TimeUsernameProblemLanguageResultExecution timeMemory
1238994TimoshCombo (IOI18_combo)C++20
0 / 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);
  while (S.size() < N)
  {
    string T = (S + s[0]) + (S + s[1] + s[0]) + (S + s[1] + s[1]) + (S + s[1] + s[2]);
    int x = press(T);
    if (x == S.size())
      S += s[2];
    else if (x == S.size() + 1)
      S += s[0];
    else
      S += s[1];
  }
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...