Submission #574824

#TimeUsernameProblemLanguageResultExecution timeMemory
574824HackapieCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N){ set<char> s; s.insert('A'); s.insert('B'); s.insert('X'); s.insert('Y'); string res; for(int i=1;i<=n;i++){ //each i for ith character //in first i we have 4 choices //afterthat we have 3 choices always char c; for(auto x:s){ string aux=res; aux+=x; int ans=press(aux); if(ans==i){ //ok this is part of the string res=aux; c=x; break; } } if(i==1)s.erase(c); } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:3: error: 'set' was not declared in this scope
    4 |   set<char> s;
      |   ^~~
combo.cpp:4:7: error: expected primary-expression before 'char'
    4 |   set<char> s;
      |       ^~~~
combo.cpp:5:3: error: 's' was not declared in this scope
    5 |   s.insert('A');
      |   ^
combo.cpp:9:3: error: 'string' was not declared in this scope
    9 |   string res;
      |   ^~~~~~
combo.cpp:9:3: 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:10:18: error: 'n' was not declared in this scope
   10 |   for(int i=1;i<=n;i++){
      |                  ^
combo.cpp:16:13: error: expected ';' before 'aux'
   16 |       string aux=res;
      |             ^~~~
      |             ;
combo.cpp:17:7: error: 'aux' was not declared in this scope
   17 |       aux+=x;
      |       ^~~
combo.cpp:21:9: error: 'res' was not declared in this scope
   21 |         res=aux;
      |         ^~~
combo.cpp:28:10: error: 'res' was not declared in this scope; did you mean 'press'?
   28 |   return res;
      |          ^~~
      |          press