Submission #738991

#TimeUsernameProblemLanguageResultExecution timeMemory
738991raul2008487Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> #define pb push_back std::string guess_sequence(int N) { string s=""; int cc=1,st; ll cs1=press("AB"),cs2=press("AX"); vector<string> vec; if(cs1==2){ s+="AB"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs2==2){ s+="AX"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1 && cs2==1){ s+="AY"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1){ s+='B'; vec.pb('A'); vec.pb('X'); vec.pb('Y'); } else if(cs2==1){ s+='X'; vec.pb('A'); vec.pb('B'); vec.pb('Y'); } else{ s+='Y'; vec.pb('B'); vec.pb('X'); vec.pb('A'); } st=s.size(); if(st==N){ return s; } for(int i=st;i<n-1;i++){ int query=press(s+v[0]+s+v[1]+v[1]+s+v[1]+v[2]); if(query==(i+1)){ s+=v[0]; } else if(query==(i+2)){ s+=v[1]; } else{ s+=v[2]; } } if(press(s+v[0])==N){ return s+v[0]; } else if(press(s+v[1])==N){ return s+v[1]; } return s+v[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:5:5: error: 'string' was not declared in this scope
    5 |     string s="";
      |     ^~~~~~
combo.cpp:5:5: note: suggested alternatives:
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'
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/string:67:11: note:   'std::pmr::string'
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
combo.cpp:7:5: error: 'll' was not declared in this scope
    7 |     ll cs1=press("AB"),cs2=press("AX");
      |     ^~
combo.cpp:8:5: error: 'vector' was not declared in this scope
    8 |     vector<string> vec;
      |     ^~~~~~
combo.cpp:8:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:2:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
combo.cpp:8:20: error: 'vec' was not declared in this scope
    8 |     vector<string> vec;
      |                    ^~~
combo.cpp:9:8: error: 'cs1' was not declared in this scope
    9 |     if(cs1==2){
      |        ^~~
combo.cpp:10:9: error: 's' was not declared in this scope; did you mean 'st'?
   10 |         s+="AB";
      |         ^
      |         st
combo.cpp:15:13: error: 'cs2' was not declared in this scope
   15 |     else if(cs2==2){
      |             ^~~
combo.cpp:16:9: error: 's' was not declared in this scope; did you mean 'st'?
   16 |         s+="AX";
      |         ^
      |         st
combo.cpp:22:9: error: 's' was not declared in this scope; did you mean 'st'?
   22 |         s+="AY";
      |         ^
      |         st
combo.cpp:28:9: error: 's' was not declared in this scope; did you mean 'st'?
   28 |         s+='B';
      |         ^
      |         st
combo.cpp:34:9: error: 's' was not declared in this scope; did you mean 'st'?
   34 |         s+='X';
      |         ^
      |         st
combo.cpp:40:9: error: 's' was not declared in this scope; did you mean 'st'?
   40 |         s+='Y';
      |         ^
      |         st
combo.cpp:45:8: error: 's' was not declared in this scope; did you mean 'st'?
   45 |     st=s.size();
      |        ^
      |        st
combo.cpp:49:20: error: 'n' was not declared in this scope
   49 |     for(int i=st;i<n-1;i++){
      |                    ^
combo.cpp:50:27: error: 'v' was not declared in this scope
   50 |         int query=press(s+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
      |                           ^
combo.cpp:61:16: error: 'v' was not declared in this scope
   61 |     if(press(s+v[0])==N){
      |                ^
combo.cpp:67:14: error: 'v' was not declared in this scope
   67 |     return s+v[2];
      |              ^
combo.cpp:6:9: warning: unused variable 'cc' [-Wunused-variable]
    6 |     int cc=1,st;
      |         ^~