Submission #210587

#TimeUsernameProblemLanguageResultExecution timeMemory
210587grobarCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int n) { string ss=""; int a1=press("A"); if(a1==1) { ss=ss+"A"; for(int i=1;i<n;i++) { string ss1=ss+"B"; if(press(ss1)==(i+1)) { ss=ss+"B"; if(ss.size()==n) { break; } } string ss2=ss+"X"; if(press(ss2)==i+1) { ss=ss+"X"; if(ss.size()==n) { break; } } string ss3=ss+"Y" if(press(ss3)==i+1) { ss=ss+"Y"; if(ss.size()==n) { break; } } } } int a2=press("B"); if(a2==1) { ss=ss+"B"; for(int i=1;i<n;i++) { string ss4=ss+"A"; if(press(ss4)==i+1) { ss=ss+"A"; if(ss.size()==n) { break; } }string ss5=ss+"X"; if(press(ss5)==i+1) { ss=ss+"X"; if(ss.size()==n) { break; } } string ss6=ss+"Y"; if(press(ss6)==i+1) { ss=ss+"Y"; if(ss.size()==n) { break; } } } } int a3=press("X"); if(a3==1) { ss=ss+"X"; for(int i=1;i<n;i++) { string ss7=ss+"A"; if(press(ss7)==i+1) { ss=ss+"A"; if(ss.size()==n) { break; } } string ss8=ss+"B"; if(press(ss8)==i+1) { ss=ss+"B"; if(ss.size()==n) { break; } } string ss9=ss+"Y"; if(press(ss9)==i+1) { ss=ss+"Y"; if(ss.size()==n) { break; } } } } int a4=press("Y"); if(a4==1) { ss=ss+"Y"; for(int i=1;i<n;i++) { string ss10=ss+"A"; if(press(ss10)==i+1) { ss=ss+"A"; if(ss.size()==n) { break; } } string ss11=ss+"X"; if(press(ss11)==i+1) { ss=ss+"X"; if(ss.size()==n) { break; } } string ss12=ss+"B"; if(press(ss12)==i+1) { ss=ss+"B"; if(ss.size()==n) { break; } } } } return ss; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:2: error: 'string' was not declared in this scope; did you mean 'std::string'?
    4 |  string ss="";
      |  ^~~~~~
      |  std::string
In file included from /usr/include/c++/10/string:39,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
combo.cpp:8:9: error: 'ss' was not declared in this scope
    8 |         ss=ss+"A";
      |         ^~
combo.cpp:11:19: error: expected ';' before 'ss1'
   11 |             string ss1=ss+"B";
      |                   ^~~~
      |                   ;
combo.cpp:12:22: error: 'ss1' was not declared in this scope
   12 |             if(press(ss1)==(i+1))
      |                      ^~~
combo.cpp:20:19: error: expected ';' before 'ss2'
   20 |             string ss2=ss+"X";
      |                   ^~~~
      |                   ;
combo.cpp:21:22: error: 'ss2' was not declared in this scope
   21 |             if(press(ss2)==i+1)
      |                      ^~~
combo.cpp:29:19: error: expected ';' before 'ss3'
   29 |             string ss3=ss+"Y"
      |                   ^~~~
      |                   ;
combo.cpp:43:13: error: 'ss' was not declared in this scope
   43 |             ss=ss+"B";
      |             ^~
combo.cpp:46:19: error: expected ';' before 'ss4'
   46 |             string ss4=ss+"A";
      |                   ^~~~
      |                   ;
combo.cpp:47:22: error: 'ss4' was not declared in this scope
   47 |             if(press(ss4)==i+1)
      |                      ^~~
combo.cpp:54:20: error: expected ';' before 'ss5'
   54 |             }string ss5=ss+"X";
      |                    ^~~~
      |                    ;
combo.cpp:55:22: error: 'ss5' was not declared in this scope
   55 |             if(press(ss5)==i+1)
      |                      ^~~
combo.cpp:63:19: error: expected ';' before 'ss6'
   63 |             string ss6=ss+"Y";
      |                   ^~~~
      |                   ;
combo.cpp:64:22: error: 'ss6' was not declared in this scope
   64 |             if(press(ss6)==i+1)
      |                      ^~~
combo.cpp:77:13: error: 'ss' was not declared in this scope
   77 |             ss=ss+"X";
      |             ^~
combo.cpp:80:19: error: expected ';' before 'ss7'
   80 |             string ss7=ss+"A";
      |                   ^~~~
      |                   ;
combo.cpp:81:22: error: 'ss7' was not declared in this scope
   81 |             if(press(ss7)==i+1)
      |                      ^~~
combo.cpp:89:19: error: expected ';' before 'ss8'
   89 |             string ss8=ss+"B";
      |                   ^~~~
      |                   ;
combo.cpp:90:22: error: 'ss8' was not declared in this scope
   90 |             if(press(ss8)==i+1)
      |                      ^~~
combo.cpp:98:19: error: expected ';' before 'ss9'
   98 |             string ss9=ss+"Y";
      |                   ^~~~
      |                   ;
combo.cpp:99:22: error: 'ss9' was not declared in this scope
   99 |             if(press(ss9)==i+1)
      |                      ^~~
combo.cpp:112:13: error: 'ss' was not declared in this scope
  112 |             ss=ss+"Y";
      |             ^~
combo.cpp:115:19: error: expected ';' before 'ss10'
  115 |             string ss10=ss+"A";
      |                   ^~~~~
      |                   ;
combo.cpp:116:22: error: 'ss10' was not declared in this scope
  116 |             if(press(ss10)==i+1)
      |                      ^~~~
combo.cpp:124:19: error: expected ';' before 'ss11'
  124 |             string ss11=ss+"X";
      |                   ^~~~~
      |                   ;
combo.cpp:125:22: error: 'ss11' was not declared in this scope
  125 |             if(press(ss11)==i+1)
      |                      ^~~~
combo.cpp:133:19: error: expected ';' before 'ss12'
  133 |             string ss12=ss+"B";
      |                   ^~~~~
      |                   ;
combo.cpp:134:22: error: 'ss12' was not declared in this scope
  134 |             if(press(ss12)==i+1)
      |                      ^~~~
combo.cpp:145:12: error: 'ss' was not declared in this scope
  145 |     return ss;
      |            ^~