Submission #474717

#TimeUsernameProblemLanguageResultExecution timeMemory
474717AnasBenMoussaDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" std::vector<int> find_subset(int l, int u, std::vector<int> w) { int df=u-l; vector<int>v(df/w[0]); if(df/w[0]>w.size()){ return 0; } else{ for(int i=0;i<df/w[0];i++){ v[i]=w[0]; } } return v; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:5:6: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |      vector<int>v(df/w[0]);
      |      ^~~~~~
      |      std::vector
In file included from /usr/include/c++/10/vector:67,
                 from molecules.h:3,
                 from molecules.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
molecules.cpp:5:13: error: expected primary-expression before 'int'
    5 |      vector<int>v(df/w[0]);
      |             ^~~
molecules.cpp:7:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     if(df/w[0]>w.size()){
      |        ~~~~~~~^~~~~~~~~
molecules.cpp:8:16: error: could not convert '0' from 'int' to 'std::vector<int>'
    8 |         return 0;
      |                ^
      |                |
      |                int
molecules.cpp:13:13: error: 'v' was not declared in this scope
   13 |             v[i]=w[0];
      |             ^
molecules.cpp:17:12: error: 'v' was not declared in this scope
   17 |     return v;
      |            ^