Submission #95623

#TimeUsernameProblemLanguageResultExecution timeMemory
95623lycCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string p = "AB"; string s = ""; int coins = press(p); if (coins == 0) { p = "X"; coins = press(p); if (coins == 0) s = "Y"; else s = "X"; } else { p = "A"; coins = press(p); if (coins == 0) s = "B"; else s = "A"; } string ok = ""; if (s != "A") ok += 'A'; if (s != "B") ok += 'B'; if (s != "X") ok += 'X'; if (s != "Y") ok += 'Y'; for (int i = 1; i < N; ++i) { p = s+ok[0] + s+ok[1]; int coins = press(p); if (coins == s.length()) { p = s+ok[2]; coins = press(p); if (coins == s.length()) s += ok[3]; else s += ok[2]; } else { p = s+ok[0]; coins = press(p); if (coins == s.length()) s += ok[1]; else s += ok[0]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (coins == s.length()) {
      |             ~~~~~~^~~~~~~~~~~~~
combo.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             if (coins == s.length()) s += ok[3];
      |                 ~~~~~~^~~~~~~~~~~~~
combo.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             if (coins == s.length()) s += ok[1];
      |                 ~~~~~~^~~~~~~~~~~~~
combo.cpp:45:12: error: 'S' was not declared in this scope
   45 |     return S;
      |            ^