Submission #261499

#TimeUsernameProblemLanguageResultExecution timeMemory
261499jairRSCombo (IOI18_combo)C++17
10 / 100
83 ms540 KiB
#include <iostream> #include "combo.h" using namespace std; string buttons[4] ={ "A", "B", "X", "Y" }; std::string guess_sequence(int N) { string seq, first; for (int i = 0; i < 4; i++) { if (press(buttons[i])) { seq = buttons[i]; first = buttons[i]; break; } } while (seq.size() != N) { for (int i = 0; i < 4; i++) { if (buttons[i] == first) { continue; } string test = seq; test += buttons[i]; int coins = press(test); if (coins == test.size()) { seq = test; i = 4; } } } return seq; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  while (seq.size() != N) {
      |         ~~~~~~~~~~~^~~~
combo.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    if (coins == test.size()) {
      |        ~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...