Submission #986842

#TimeUsernameProblemLanguageResultExecution timeMemory
986842TsaganaCombo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include "combo.h"
#include<bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define F first
#define S second

using namespace std;

string guess_sequence(int N) {
  string S;
  string o;

  if (press("AB")) {
    if (press("A")) {S = "A"; o = "BXY";}
    else {S = "B"; o = "AXY";}
  }
  else {
    if (press("X")) {S = "X"; o = "ABY";}
    else {S = "Y"; o = "ABX";}
  }

  for (int i = 1; i < N-1; i++) {
      string tmp = S + o[0] + o[0] + S + o[0] + o[1] + S + o[0] + o[2] + S + o[1];
      int ct = press(tmp);
      if (ct == i+2) S += o[0];
      else if (ct == i+1) S += o[1];
      else S += o[2];
  }
  if (press(S + o[0]) == N) S += o[0];
  else if (press(S + o[1]) == N) S += o[1];
  else S += o[2];
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...