Submission #401558

#TimeUsernameProblemLanguageResultExecution timeMemory
401558_DaNeK_Combo (IOI18_combo)C++17
30 / 100
47 ms444 KiB
#include <bits/stdc++.h> using namespace std; vector < char > m = {'A', 'B', 'Y', 'X'}; int press(string p); string guess_sequence(int N) { string res = ""; int cur = 1, i = 0, first = 0; while (i < 3 && press(res + m[i]) != cur) ++i; res += m[i]; m.erase(m.begin() + i); cur = 2; while (res.size() < N) { int ind = 0, cnt = 0; while (cnt < 2) { if (press(res + m[ind]) == cur) break ; ++cnt; ++ind; } ++cur; res += m[ind]; } return res; } /*int main () { int n; cin >> n; cout << guess_sequence(n) << "\n"; }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (res.size() < N)
      |            ~~~~~~~~~~~^~~
combo.cpp:12:25: warning: unused variable 'first' [-Wunused-variable]
   12 |     int cur = 1, i = 0, first = 0;
      |                         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...