Submission #554069

#TimeUsernameProblemLanguageResultExecution timeMemory
554069d4xnCombo (IOI18_combo)C++17
0 / 100
18 ms300 KiB
#include "combo.h"

#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

string guess_sequence(int N) {
  string p;
  int x = 0;

  for (char i : {'A', 'B', 'X', 'Y'}) {
    p.pb(i);

    x = press(p);
    if (x) break;

    p.pop_back();
  }

  vector<char> v;
  for (char i : {'A', 'B', 'X', 'Y'}) {
    if (p[0] == i) continue;
    v.pb(i);
  }

  for (int i = 1; i < N; i++) {

    for (int j = 0; j < 3; j++) {
      int k = j + rand() % (3 - j);
      swap(v[j], v[k]);
    }

    for (char &j : v) {
      p.pb(j);
      int y = press(p);
      if (y > x) break;
      p.pop_back();
    }
  }
  
  return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...