Submission #107239

#TimeUsernameProblemLanguageResultExecution timeMemory
107239wonyoungCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <string> using namespace std; string guess_sequence(int N) { const char buttons[4] = { 'A', 'B', 'X', 'Y' }; string s = ""; int i; while (s.length() < N) { for (i=0; i<3; i++) { string query_string = ""; query_string.append(s); query_string.push_back(buttons[i]); int n = press(query_string); if (n > s.length()) { break; } } s.push_back(buttons[i]); } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     while (s.length() < N)
      |            ~~~~~~~~~~~^~~
combo.cpp:16:21: error: 'press' was not declared in this scope
   16 |             int n = press(query_string);
      |                     ^~~~~
combo.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if (n > s.length())
      |                 ~~^~~~~~~~~~~~