Submission #960221

#TimeUsernameProblemLanguageResultExecution timeMemory
960221RyaroXDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" typedef long long ll; ll dp[20005]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll n=w.size(); ll d=0; dp[0]=1; for(ll i=0;i<n;i++){ ll a=w[i]; for(ll j=0;j<u;j++){ if(dp[j]>0){ dp[j+a]=a; if(j+a>=l and j+a<=u){ ll s=j+a; vector <ll> V; while(s>0){ //cout<<s<<" "<<dp[s]<<"\n"; V.push_back(dp[s]); s=s-dp[s]; } reverse(V.begin(), V.end()); return V; } } } } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:17:21: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   17 |                     vector <ll> V;
      |                     ^~~~~~
      |                     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 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:17:31: error: expected primary-expression before '>' token
   17 |                     vector <ll> V;
      |                               ^
molecules.cpp:17:33: error: 'V' was not declared in this scope
   17 |                     vector <ll> V;
      |                                 ^
molecules.cpp:23:21: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
   23 |                     reverse(V.begin(), V.end());
      |                     ^~~~~~~
      |                     std::reverse
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from molecules.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:1165:5: note: 'std::reverse' declared here
 1165 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
molecules.cpp:8:8: warning: unused variable 'd' [-Wunused-variable]
    8 |     ll d=0;
      |        ^