Submission #1192701

#TimeUsernameProblemLanguageResultExecution timeMemory
1192701stdfloatCombo (IOI18_combo)C++20
100 / 100
8 ms520 KiB
#include <bits/stdc++.h> #include "combo.h" // #include "grader.cpp" using namespace std; string guess_sequence(int n) { string s = "AB"; if (press(s)) { s = "A"; if (!press(s)) s = "B"; } else { s = "X"; if (!press(s)) s = "Y"; } vector<string> v = {"A", "B", "X", "Y"}; for (int i = 0; i < 4; i++) { if (s == v[i]) { v.erase(v.begin() + i); break; } } if (n == 1) return s; for (int i = 1; i < n - 1; i++) { string t = s + v[1]; for (auto j : v) t += s + v[2] + j; s += v[press(t) - i]; } for (auto i : v) { s += i; if (i == v.back() || press(s) == n) return s; s.pop_back(); } }

Compilation message (stderr)

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