Submission #501322

#TimeUsernameProblemLanguageResultExecution timeMemory
501322shantolCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string a; string ex; for(int i=0;i<N;i++){ if(!i){ if(press("AB")){ if(press("A"))a+="A";ex="BXY"; else a+="B";ex="AXY"; } else if(press("X"))a+="X";ex="ABY"; else a+="Y";ex+="ABX"; } else if(i==N-1){ if(press(a+ex[0]))a+=ex[0]; else if(press(ex[1]))a+=ex[1]; else a+=ex[2]; } else{ int p=press(a+ex[0]+ex[0]+a+ex[0]+ex[1]+a+ex[0]+ex[2]+a+ex[1]); if(p==2)a+=ex[0]; else if(p==1)a+=ex[1]; else a+=ex[2]; } } return a; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   12 |                 if(press("A"))a+="A";ex="BXY";
      |                 ^~
combo.cpp:12:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   12 |                 if(press("A"))a+="A";ex="BXY";
      |                                      ^~
combo.cpp:13:17: error: expected '}' before 'else'
   13 |                 else a+="B";ex="AXY";
      |                 ^~~~
combo.cpp:11:28: note: to match this '{'
   11 |             if(press("AB")){
      |                            ^
combo.cpp:13:17: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   13 |                 else a+="B";ex="AXY";
      |                 ^~~~
combo.cpp:13:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   13 |                 else a+="B";ex="AXY";
      |                             ^~
combo.cpp:15:13: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   15 |             else if(press("X"))a+="X";ex="ABY";
      |             ^~~~
combo.cpp:15:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   15 |             else if(press("X"))a+="X";ex="ABY";
      |                                       ^~
combo.cpp:16:13: error: 'else' without a previous 'if'
   16 |             else a+="Y";ex+="ABX";
      |             ^~~~
combo.cpp:19:9: error: 'else' without a previous 'if'
   19 |         else if(i==N-1){
      |         ^~~~
combo.cpp:19:17: error: 'i' was not declared in this scope
   19 |         else if(i==N-1){
      |                 ^
combo.cpp:21:32: error: could not convert 'ex.std::__cxx11::basic_string<char>::operator[](1)' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   21 |             else if(press(ex[1]))a+=ex[1];
      |                                ^
      |                                |
      |                                __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
combo.cpp:30:5: warning: no return statement in function returning non-void [-Wreturn-type]
   30 |     }
      |     ^
combo.cpp: At global scope:
combo.cpp:31:5: error: expected unqualified-id before 'return'
   31 |     return a;
      |     ^~~~~~
combo.cpp:32:1: error: expected declaration before '}' token
   32 | }
      | ^