Submission #554078

#TimeUsernameProblemLanguageResultExecution timeMemory
554078d4xn콤보 (IOI18_combo)C++17
10 / 100
46 ms440 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;

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

    if (press(p)) 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);

      if (press(p) == i+1) break;
      
      p.pop_back();
    }
  }
  
  return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...