Submission #829333

#TimeUsernameProblemLanguageResultExecution timeMemory
829333abczzCombo (IOI18_combo)C++14
5 / 100
1 ms208 KiB
#include "combo.h"
#include <iostream>
#define ll long long

using namespace std;

std::string guess_sequence(int N) {
  string S, T, X;
  ll x = press("AB");
  if (x >= 1) {
    X += "XY";
    x = press("A");
    if (x >= 1) S += 'A', X += 'B';
    else S += 'B', X += 'A';
  }
  else {
    X += "AB";
    x = press("X");
    if (x >= 1) S += 'X', X += 'Y';
    else S += 'Y', X += 'X';
  }
  for (int i=1; i<N-1; ++i) {
    T = S + X[0] + X[0];
    T += S + X[0] + X[1];
    T += S + X[0] + X[2];
    T += S + X[1];
    x = press(T);
    if (x-i == 0) {
      S += X[2];
    }
    else if (x-i == 1) {
      S += X[1];
    }
    else S += X[0];
  }
  T = S + X[0];
  T += S + X[1];
  x = press(T);
  if (x == N-1) S += X[2];
  else {
    x = press(S+X[0]);
    if (x == N-1) S += X[1];
    else S += X[0];
  }
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...