Submission #466804

#TimeUsernameProblemLanguageResultExecution timeMemory
466804jazzupCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N){ std::string p = ""; p="AB"; char a[3]; int m = press(p); int c; else if(m==1){ c=press("A"); if(c==1){ a[0]='B'; a[1]='X'; a[2]='Y'; p="A"; } else{ a[0]='A'; a[1]='X'; a[2]='Y'; p="B"; } } else if(m==0){ c=press("X"); if(c==1){ a[0]='A'; a[1]='B'; a[2]='Y'; p="X"; } else{ a[0]='A'; a[1]='B'; a[2]='X'; p="Y"; } } std::string S; int x=p.length(); for(int i=x;i<N-1;i++){ S=p; S+=a[0]; S+=a[0]; S+=p; S+=a[0]; S+=a[1]; S+=p; S+=a[0]; S+=a[2]; S+=p; S+=a[1]; c=press(S); if(c==p.length()){ p+=a[2]; } else if(c==p.length()+1){ p+=a[1]; } else{ p+=a[0]; } } S=p; S+=a[0]; c=press(S); if(c==p.length()+1) return S; else{ S=p; S+=a[1]; c=press(S); if(c==p.length()+1) return S; else{ p+=a[2]; return p; } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:2: error: 'else' without a previous 'if'
   11 |  else if(m==1){
      |  ^~~~
combo.cpp:61:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |   if(c==p.length()){
      |      ~^~~~~~~~~~~~
combo.cpp:64:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |   else if(c==p.length()+1){
      |           ~^~~~~~~~~~~~~~
combo.cpp:78:6: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |  if(c==p.length()+1)
      |     ~^~~~~~~~~~~~~~
combo.cpp:86:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |   if(c==p.length()+1)
      |      ~^~~~~~~~~~~~~~