제출 #799155

#제출 시각아이디문제언어결과실행 시간메모리
79915512345678콤보 (IOI18_combo)C++17
100 / 100
24 ms632 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

vector<char> c(4), ch;

string guess_sequence(int N) {
  string p;
  if (press("AB")) press("A") ? p='A' : p='B';
  else if (press("X")) p='X';
  else p='Y';
  c[0]='A'; c[1]='B'; c[2]='X'; c[3]='Y';
  for (auto x:c) if (x!=p[0]) ch.push_back(x);
  if (N==1) return p;
  for (int i=2; i<N; i++)
  {
    string tmp=p+ch[1];
    for (auto x:ch) tmp+=p+ch[2]+x;
    p+=ch[press(tmp)-i+1];
  }
  if (press(p+'A'+p+'B')==N) press(p+'A')==N ? p+='A' : p+='B';
  else if (press(p+'X')==N) p+='X';
  else p+="Y";
  return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...