Submission #501314

#TimeUsernameProblemLanguageResultExecution timeMemory
501314shantolCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.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:8:16: error: 'press' was not declared in this scope
    8 |             if(press("AB")){
      |                ^~~~~
combo.cpp:9:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    9 |                 if(press("A"))a+="A";ex="BXY";
      |                 ^~
combo.cpp:9:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    9 |                 if(press("A"))a+="A";ex="BXY";
      |                                      ^~
combo.cpp:10:17: error: expected '}' before 'else'
   10 |                 else a+="B";ex="AXY";
      |                 ^~~~
combo.cpp:8:28: note: to match this '{'
    8 |             if(press("AB")){
      |                            ^
combo.cpp:10:17: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   10 |                 else a+="B";ex="AXY";
      |                 ^~~~
combo.cpp:10:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   10 |                 else a+="B";ex="AXY";
      |                             ^~
combo.cpp:12:21: error: 'press' was not declared in this scope
   12 |             else if(press("X"))a+="X";ex="ABY";
      |                     ^~~~~
combo.cpp:12:13: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   12 |             else if(press("X"))a+="X";ex="ABY";
      |             ^~~~
combo.cpp:12:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   12 |             else if(press("X"))a+="X";ex="ABY";
      |                                       ^~
combo.cpp:13:13: error: 'else' without a previous 'if'
   13 |             else a+="Y";ex+="ABX";
      |             ^~~~
combo.cpp:16:9: error: 'else' without a previous 'if'
   16 |         else if(i==N-1){
      |         ^~~~
combo.cpp:16:17: error: 'i' was not declared in this scope
   16 |         else if(i==N-1){
      |                 ^
combo.cpp:17:16: error: 'press' was not declared in this scope
   17 |             if(press(a+ex[0]))a+=ex[0];
      |                ^~~~~
combo.cpp:22:19: error: 'press' was not declared in this scope
   22 |             int p=press(a+ex[0]+ex[0]+a+ex[0]+ex[1]+a+ex[0]+ex[2]+a+ex[1]);
      |                   ^~~~~
combo.cpp:27:5: warning: no return statement in function returning non-void [-Wreturn-type]
   27 |     }
      |     ^
combo.cpp: At global scope:
combo.cpp:28:5: error: expected unqualified-id before 'return'
   28 |     return a;
      |     ^~~~~~
combo.cpp:29:1: error: expected declaration before '}' token
   29 | }
      | ^