Submission #765927

#TimeUsernameProblemLanguageResultExecution timeMemory
765927tengiz05Combo (IOI18_combo)C++17
100 / 100
26 ms580 KiB
#include "combo.h" #include "iostream" #ifndef EVAL #include "grader.cpp" #endif using namespace std; std::string guess_sequence(int n) { string s; if (press("AB") >= 1) { if (press("A")) { s = "A"; } else { s = "B"; } } else { if (press("X")) { s = "X"; } else { s = "Y"; } } string f = "ABXY"; f.erase(f.begin() + f.find(s[0])); while (s.size() < n) { if (n - s.size() == 1) { if (press(s + f[0]) == n) { s += f[0]; } else if (press(s + f[1]) == n) { s += f[1]; } else { s += f[2]; } } else { int val = press(s + f[0] + s + f[1] + f[0] + s + f[1] + f[1] + s + f[1] + f[2]); if (val == s.size()) { s += f[2]; } else if (val == s.size() + 1) { s += f[0]; } else { s += f[1]; } } } return s; }

Compilation message (stderr)

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