Submission #154059

#TimeUsernameProblemLanguageResultExecution timeMemory
154059nthoangCombo (IOI18_combo)C++11
5 / 100
5 ms296 KiB
#include <bits/stdc++.h>

#ifndef LOCAL
#include "combo.h"
#endif

#ifdef LOCAL
#include "/Users/nth842002/Library/debug.h"
int press(string p);
int main();
#endif

using namespace std;

const char moves[] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int n) {
  for (int mask = 0; mask < (1 << (n + n)); mask++) {
    string s;
    s.resize(n);
    for (int i = 0, t = mask; i < n; i++) {
      s[i] = moves[t % 4];
      t /= 4;
    }
    if (press(s) == n) {
      return s;
    }
  }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...