Submission #1236984

#TimeUsernameProblemLanguageResultExecution timeMemory
1236984pcpCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
std::string guess_sequence(int N) {
  std::string p = "";

  string lts = "ABXY";

  string l=""; 
  string lt="";
  if (press("AB")){
    p = (press("A")) ? "A" : "B";
    
  }else {
    p = (press("X")) ? "X" : "Y";
  }

  for (char x : lts){
    if (x==p.back())continue;
    if ((int)lt.size()==2)l+=x;
    else{
      lt+=x;
    }
  } 


  while ((int)p.size() < N){
    string juan = p+lt[0]+lt[1]+p+lt[0]+lt[2]+p+lt[0]+lt[0]+p+lt[1];
    int rslt=press(juan);
    if (rslt == (int)p.size())p+=l;
    else if (rslt=(int)p.size()+1) {
      p+=lt[1];
    }else p+=lt[0];
  }


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