제출 #1244213

#제출 시각아이디문제언어결과실행 시간메모리
1244213greenbinjack콤보 (IOI18_combo)C++20
97 / 100
7 ms484 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N) {
  string pref = "";
  vector <char> ch;
  if (press ("A") > 0) {
    pref += 'A', ch = {'B', 'X', 'Y'};
  } else if (press ("B") > 0) {
    pref += 'B', ch = {'A', 'X', 'Y'};
  } else if (press ("X") > 0) {
    pref += 'X', ch = {'A', 'B', 'Y'};
  } else {
    pref += 'Y', ch = {'A', 'B', 'X'};
  }

  for (int i = 1; i <= N - 2; i++) {
    int x = press (pref + ch[0] + pref + ch[1] + ch[0] + pref + ch[1] + ch[1] + pref + ch[1] + ch[2]);
    if (x == i + 2) pref += ch[1];
    else if (x == i + 1) pref += ch[0];
    else pref += ch[2];
  }

  if (N > 1) {
    if (press (pref + ch[0] + pref + ch[1]) == N) {
      if (press (pref + ch[0]) == N) {
        pref += ch[0];
      } else {
        pref += ch[1];
      }
    } else {
      pref += ch[2];
    }
  }
  
  return pref;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...