제출 #961547

#제출 시각아이디문제언어결과실행 시간메모리
961547mannshah1211Combo (IOI18_combo)C++17
10 / 100
26 ms1468 KiB
#include <combo.h>
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int n) {
  string s;
  string a[4] = {"A", "B", "X", "Y"};
  int fr = -1;
  for (int j = 0; j < 4; j++) {
    if (press(a[j]) == 1) {
      s += a[j];
      fr = j;
    }
  }
  for (int i = 1; i < n; i++) {
    int cnt = 0, ind = -1, lst = -1;
    for (int j = 0; j < 4; j++) {
      if (j != fr && cnt < 2) {
        cnt++;
        if (cnt == 2) {
          lst = j;
        }
        if (press(s + a[j]) == (i + 1)) {
          ind = j;
        }
      }
    }
    if (ind != -1) {
      s += a[ind];
    } else {
      for (int j = lst + 1; j < 4; j++) {
        if (j != fr) {
          s += a[j];
        }
      }
    }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...