Submission #524208

#TimeUsernameProblemLanguageResultExecution timeMemory
524208reniCombo (IOI18_combo)C++14
100 / 100
30 ms652 KiB
#include "combo.h"
#include<iostream>
using namespace std;
std::string guess_sequence(int n) {

  string r, oth;
  if(press("XY")>0){
  if(press("X")==1){r="X"; oth ="ABY";}
  else {r="Y"; oth="ABX";}}

  else if(press("A")==1){r="A"; oth="XYB"; }
  else {r="B"; oth="XYA";}


  for(int i=2;i<n;i++)
  {
      long long br=press(r+oth[2]+oth[0]+r+oth[2]+oth[1]+r+oth[2]+oth[2]+r+oth[1]);
      if(br==i+1)r=r+oth[2];
      if(br==i)r=r+oth[1];
      else if(br==i-1)r=r+oth[0];
  }
  if(n>1)
  {
      if(press(r+oth[2])==n)r=r+oth[2];
      else if(press(r+oth[1])==n)r=r+oth[1];
      else r=r+oth[0];
  }

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