Submission #826955

#TimeUsernameProblemLanguageResultExecution timeMemory
826955wortelwormCombo (IOI18_combo)C++17
30 / 100
43 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { char first; int coins = press("AB"); if (coins > 0) { coins = press("A"); if (coins > 0) { first = 'A'; } else { first = 'B'; } } else { coins = press("X"); if (coins > 0) { first = 'X'; } else { first = 'Y'; } } string result = ""; result += first; string options; for (char c : "ABXY") { if (c != first) { options += c; } } for (int i = 1; i < N; i++) { for (int j = 0; j < 2; j++) { coins = press(result + options[j]); if (coins > result.size()) { // this is correct result += options[j]; } } if (result.size() == i) { result += options[2]; } } return result; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             if (coins > result.size()) {
      |                 ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:43:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |         if (result.size() == i) {
      |             ~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...