Submission #383682

#TimeUsernameProblemLanguageResultExecution timeMemory
383682wlh_codeCombo (IOI18_combo)C++17
10 / 100
55 ms540 KiB
#include "combo.h" using namespace std; string guess_sequence (int N) { string keys = "ABXY"; string s; for (int i = 0; i < 4; ++i) { string t; t += keys[i]; if (press(t)) { s += keys[i]; keys.erase(keys.begin() + i); break; } } for (int i = 1; i < N; ++i) { for (int j = 0; j < 2; ++j) { string t = s; t += keys[j]; if (press(t) > i) { s += keys[j]; break; } } if (s.length() == i) s += keys[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if (s.length() == i) s += keys[2];
      |       ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...