Submission #1046618

#TimeUsernameProblemLanguageResultExecution timeMemory
1046618JerCombo (IOI18_combo)C++17
10 / 100
36 ms856 KiB
#include "combo.h"
using namespace std;

string guess_sequence(int n)
{
  string letters = "ABXY", start, curr, trial;

  for (char x : letters)
  {
    start = x;
    if (press(start) == 1)
    {
      break;
    }
  }

  curr = start;

  while ((int)curr.size() < n)
  {
    bool found_next_char = false;
    for (char x : letters)
    {
      if (x == start[0])
        continue;

      trial = curr + x;
      int res = press(trial);
      if (res > (int)curr.size())
      {
        curr += x;
        found_next_char = true;
        break;
      }
    }
    if (!found_next_char)
      break;
  }

  return curr;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...