Submission #668427

#TimeUsernameProblemLanguageResultExecution timeMemory
668427allin27xCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; string guess_sequence(int N){ string S = ""; if (press("AB")){ if (press("A")) S = "A"; else S = "B"; } else { if (press("X")) S = "X"; else S = "Y"; } char A = 'A', B='B', C = 'X'; if (S=="A") A = 'Y'; else if (S=="B") B='Y'; else if (S=="X") C = 'Y'; int res; while (S.size() < N-1){ res = press(S+A+S+B+A+S+B+B+S+B+C); if (res == S.size()){ S+=C; } else if (res == S.size()+1){ S+=A; } else { S+=B; } } if (press(S+A+S+B)==N){ if (press(S+A)==N) S+=A; else S+=B; } else { S+=C; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:9: error: 'press' was not declared in this scope
    7 |     if (press("AB")){
      |         ^~~~~
combo.cpp:16:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while (S.size() < N-1){
      |            ~~~~~~~~~^~~~~
combo.cpp:17:15: error: 'press' was not declared in this scope; did you mean 'res'?
   17 |         res = press(S+A+S+B+A+S+B+B+S+B+C);
      |               ^~~~~
      |               res
combo.cpp:18:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if (res == S.size()){
      |             ~~~~^~~~~~~~~~~
combo.cpp:20:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         } else if (res == S.size()+1){
      |                    ~~~~^~~~~~~~~~~~~
combo.cpp:26:9: error: 'press' was not declared in this scope; did you mean 'res'?
   26 |     if (press(S+A+S+B)==N){
      |         ^~~~~
      |         res