제출 #414857

#제출 시각아이디문제언어결과실행 시간메모리
414857Mohammed_AtalahCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;




std::string guess_sequence(int N) {
  char cs[4] = {'A', 'B', 'X', 'Y'};
  string res = "";
  for (int i = 0; i < 4; i++) {
    string s = "";
    s += cs[i];
    s += "Y";

    if (press(s) == 1) {
      res += cs[i];
      cs[i] = '0';
      break;
    }
  }

  if (N == 1) {
    return res;
  }


  for (int i = 1; i < N; i++) {
    for (int e = 0; e < 4; e++) {
      if (cs[e] == '0') {
        continue;
      }
      string check = res;
      check += cs[e];
      // cout << check;

      if (press(check) == i + 1) {
        res += cs[e];
        break;
      }
    }
  }
  return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...