Submission #254924

#TimeUsernameProblemLanguageResultExecution timeMemory
254924niyuCombo (IOI18_combo)C++14
0 / 100
0 ms200 KiB
using namespace std;
#include "combo.h"
 
char c[] = {'A', 'B', 'X', 'Y'};
char f;
char s[3];
 
string guess_sequence(int N) {
  string ret = "";
  int t = press("AB");
  if (t > 0) {
    int tmp = press("A");
    if (tmp > 0) f = 'A';
    else f = 'B';
  }
  else {
    int tmp = press("X");
    if (tmp > 0) f = 'X';
    else f = 'Y';
  }
  ret += f;
  if (N == 1) return ret;
  int j = 0;
  for (int i = 0; i < 4; i++) {
    if (c[i] == f) continue;
    s[j] = c[i];
    j++;
  }
  ret += f;
  for (int i = 0; i < N - 2; i++) {
    t = press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]);
    ret += s[t - ret.size()];
  }
  t = press(ret + s[0]);
  if (t == N) return (ret + s[0]);
  t = press(ret + s[1]);
  if (t == N) return (ret + s[1]);
  return (ret + s[2]);
}
 
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...