Submission #211519

#TimeUsernameProblemLanguageResultExecution timeMemory
211519Harry464Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <string> using namespace std; string guess_sequence(int N) { char slovo[4]={'A','B','X','Y'}; int prvoSlovo, odgovor; string s; if(press("AB")) { if(press("A")) prvoSlovo=0; else prvoSlovo=1; } else { if(press("X")) prvoSlovo=2; else prvoSlovo=3; } s+=slovo[prvoSlovo]; for(int i=2;i<N;i++) { odgovor=press(s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+1)%4] + s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+2)%4] + s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+3)%4] + s + slovo[(prvoSlovo+2)%4]); if(odgovor==s.size()) s+=slovo[(prvoSlovo+3)%4]; else if(odgovor==s.size()+1) s+=slovo[(prvoSlovo+2)%4]; else s+=slovo[(prvoSlovo+1)%4]; } if(press(s+"A"+s+"B")>s.size()) { if(press(s+"A")>s.size()) s+="A"; else s+="B"; } else { if(press(s+"X")>s.size()) s+="X"; else s+="Y"; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:6: error: 'press' was not declared in this scope
   11 |   if(press("AB"))
      |      ^~~~~
combo.cpp:26:13: error: 'press' was not declared in this scope
   26 |     odgovor=press(s + slovo[(prvoSlovo+1)%4] + slovo[(prvoSlovo+1)%4] +
      |             ^~~~~
combo.cpp:31:15: 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(odgovor==s.size()) s+=slovo[(prvoSlovo+3)%4];
      |        ~~~~~~~^~~~~~~~~~
combo.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     else if(odgovor==s.size()+1) s+=slovo[(prvoSlovo+2)%4];
      |             ~~~~~~~^~~~~~~~~~~~
combo.cpp:36:6: error: 'press' was not declared in this scope
   36 |   if(press(s+"A"+s+"B")>s.size())
      |      ^~~~~