Submission #1236977

#TimeUsernameProblemLanguageResultExecution timeMemory
1236977pcpCombo (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")>0){
    p = (press("A")) ? "A" : "B";
    
  }else {
    p = (press("C")) ? "C" : "D";
  }

  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]+p+lt[1];
    if (press(juan) == (int)p.size())p+=l;


    else{
      string juan_la_venganza=p+lt[0];
      if (press(juan_la_venganza)==(int)p.size()+1)p+=lt[0];
      else p+=lt[1];
    }
  }


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