제출 #702431

#제출 시각아이디문제언어결과실행 시간메모리
702431kishtarn555콤보 (IOI18_combo)C++14
5 / 100
1 ms208 KiB
#include "combo.h"

using namespace std;

string guess_sequence(int N) {
  string p = "";
  if (press("AB")) {
    if (press("A")) {
      p="A";
    } else {
      p="B";
    }
  } else{
    if (press("X")) {
      p="X";
    } else {      
      p="Y";
    }
  }
  string tmp="ABXY";
  string chars="";
  for (int i=0; i < 4; i++) {
    if (tmp[i]!=p[0]) {
      chars+=tmp[i];
    }
  }
  string guess;
  for (int i = 1; i < N-1; ++i) {
    guess="";
    for (int j=0; j < 3; j++) {
      guess += p+chars[0]+chars[j];
    }
    guess += p+chars[1];
    int x = press(guess);
    if (x == i+2) p+=chars[0];
    else if (x == i+1) p+=chars[1];
    else p+=chars[2];
  }
  guess = p+chars[0]+p+chars[1];
  if (press(guess)==N) {
    if (press(p+chars[0])==N) {
      p+=chars[0];
    } else {      
      p+=chars[1];
    }
  } else {
    p+=chars[2];
  }

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