Submission #989771

#TimeUsernameProblemLanguageResultExecution timeMemory
989771mannshah1211Combo (IOI18_combo)C++17
10 / 100
41 ms1112 KiB
/**
 *    author: tourist
 *    created:
**/
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

vector<string> alphabet = {"A", "B", "X", "Y"};

string guess_sequence(int n) {
  string firs = "?", ans;
  for (int i = 0; i < 3; i++) {
    if (press(alphabet[i]) == 1) {
      firs = alphabet[i];
      break;
    }
  }
  if (firs == "?") {
    firs = alphabet[3];
  }
  ans += firs;
  vector<int> possible;
  for (int i = 0; i < 4; i++) {
    if (alphabet[i] != firs) {
      possible.push_back(i);
    }
  }
  for (int i = 1; i < n; i++) {
    for (int x : possible) {
      if (press(ans + alphabet[x]) == i + 1) {
        ans += alphabet[x];
        break;
      }
    }
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...