Submission #769154

#TimeUsernameProblemLanguageResultExecution timeMemory
769154pashkaCombo (IOI18_combo)C++14
5 / 100
10 ms208 KiB
#include "combo.h" char guess_first_letter() { int x = press("AB"); if (x > 0) { int y = press("A"); if (y > 0) { return 'A'; } else { return 'B'; } } else { int y = press("X"); if (y > 0) { return 'X'; } else { return 'Y'; } } } std::string guess_sequence(int N) { std::string s; s += guess_first_letter(); std::string chars; for (char c : "ABXY") { if (c != s[0]) chars += c; } for (int i = 0; i < N - 2; i++) { int x = press( s + chars[0] + chars[0] + s + chars[0] + chars[1] + s + chars[0] + chars[2] + s + chars[1]); if (x == s.size()) { s += chars[2]; } else if (x == s.size() + 1) { s += chars[1]; } else { s += chars[0]; } } int x = press(s + chars[0] + s + chars[1]); if (x == N) { x = press(s + chars[0]); if (x == N) { return s + chars[0]; } else { return s + chars[1]; } } else { return s + chars[2]; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if (x == s.size()) {
      |             ~~^~~~~~~~~~~
combo.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         } else if (x == s.size() + 1) {
      |                    ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...