Submission #1325924

#TimeUsernameProblemLanguageResultExecution timeMemory
1325924x_aCombo (IOI18_combo)C++20
100 / 100
7 ms476 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
  string p = "", s = "";
  int x;
  char t = 'x';
  vector<char> A = {'A', 'B', 'X', 'Y'}, c;
  x = press("AB");
  if(x >= 1){
    if(press("A")) s = "A";
    else s = "B";
  }
  else{
    if(press("X")) s = "X";
    else s = "Y";
  }
  if(N == 1) return s;
  for(char x : A) if(x != s[0]) c.push_back(x);
  int last = 1;

  for(int i = 1; i < N - 1; i ++){
    x = press(s + c[0] + s + c[1] + c[0] + s + c[1] + c[1] + s + c[1] + c[2]);
    if(x == last + 1){
      s += c[0];
    }
    else if(x == last + 2){
      s += c[1];
    }
    else{
      s += c[2];
    }
    last ++;
  }
  int cnt = 0;
  for(char x : c){
    if(cnt == 2){
      s += x;
      break;
    }
    if(press(s + x) == N) {
      s += x;
      break;
    }
    cnt ++;
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...