제출 #524205

#제출 시각아이디문제언어결과실행 시간메모리
524205reni콤보 (IOI18_combo)C++17
97 / 100
29 ms596 KiB
#include "combo.h"
#include<iostream>
using namespace std;
std::string guess_sequence(int n) {

  string r, oth;

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

  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...