Submission #774070

#TimeUsernameProblemLanguageResultExecution timeMemory
774070jasminPrisoner Challenge (IOI22_prison)C++17
Compilation error
0 ms0 KiB
#include "prison.h" #include <vector> std::vector<std::vector<int>> devise_strategy(int n) { vector<int> ans(n+1, -1); ans[0][0]=0; for(int i=1; i<=n; i++){ ans[i][0]=1; } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(j<i){ ans[i][j]=-2; } else{ ans[i][j]=-1; } } } return ans; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> ans(n+1, -1);
      |     ^~~~~~
prison.cpp:7:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from prison.h:1,
                 from prison.cpp:1:
/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 prison.h:1,
                 from prison.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
prison.cpp:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> ans(n+1, -1);
      |            ^~~
prison.cpp:9:5: error: 'ans' was not declared in this scope
    9 |     ans[0][0]=0;
      |     ^~~