Submission #1142613

#TimeUsernameProblemLanguageResultExecution timeMemory
1142613rayankadCombo (IOI18_combo)C++20
0 / 100
0 ms396 KiB
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
  string p = "AB";
  int coins = press(p);
  string P;
  string buttons = "BXY";
  if(coins >0){
    coins = press("A");
    if(coins == 1){
      P = "A"; 
    }
    else{
      buttons = "AXY";
      P = "B";
    }

  }
  else{
    coins = press("X");
    if(coins == 1){
      buttons = "ABY";
      P = "X";
    }
    else{
      buttons = "ABX";
      P = "Y";
    }
  }
  while(P.size() < N-1){
    int q = press(P+buttons[0] + P+buttons[1]+buttons[1] + P+buttons[1]+buttons[2] + P+buttons[1]+buttons[0]);
    if(q == P.size()){
      P+=buttons[2];
    }
    else if(q == P.size()+1){
      P+=buttons[0];
    }
    else{
      P+=buttons[1];
    }
  }
  int q = press(P+buttons[0]+buttons[1]);
  if(q >= P.size()+1){
    q = press(P+buttons[0]);
    if(q == P.size()+1){
      return P+buttons[0];
    }
    return P+buttons[1];
  }
  return P+buttons[2];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...