Submission #756165

#TimeUsernameProblemLanguageResultExecution timeMemory
756165thinknoexitCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { string ans = ""; string p = ""; if (press("AB")) { if (press("A")) ans = "A", p = "BXY"; else ans = "B", p = "AXY"; } else { if (press("X")) ans = "X", p = "ABY"; else ans = "Y", p = "ABX"; } while (ans.size() != N - 1) { int t = ansress(ans + p[0] + ans + p[1] + p[0] + ans + p[1] + p[1] + ans + p[1] + p[2]); if (ans.size() == t - 1) ans += p[0]; else if (ans.size() == t - 2) ans += p[1]; else ans += p[2]; } if (ans.size() != ansress(ans + p[0])) ans += p[0]; else if (ans.size() != ansress(ans + p[1])) ans += p[1]; else ans += p[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |   while (ans.size() != N - 1) {
      |          ~~~~~~~~~~~^~~~~~~~
combo.cpp:16:13: error: 'ansress' was not declared in this scope; did you mean 'press'?
   16 |     int t = ansress(ans + p[0] + ans + p[1] + p[0] + ans + p[1] + p[1] + ans + p[1] + p[2]);
      |             ^~~~~~~
      |             press
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 |     if (ans.size() == t - 1) ans += p[0];
      |         ~~~~~~~~~~~^~~~~~~~
combo.cpp:18:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     else if (ans.size() == t - 2) ans += p[1];
      |              ~~~~~~~~~~~^~~~~~~~
combo.cpp:21:21: error: 'ansress' was not declared in this scope; did you mean 'press'?
   21 |   if (ans.size() != ansress(ans + p[0])) ans += p[0];
      |                     ^~~~~~~
      |                     press