Submission #1003541

#TimeUsernameProblemLanguageResultExecution timeMemory
1003541LuvidiDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=w.size(); vector<pll> v; for(int i=0;i<n;i++){ v.pb({w[i],i}); } sort(v.begin(),v.end()); ll pre[n+1]; pre[0]=0; for(int i=1;i<=n;i++)pre[i]=pre[i-1]+v[i-1].fs; for(int len=1;len<=n;len++){ if(pre[len]>u)continue; if(pre[n]-pre[n-len]<l)continue; ll s=pre[len]; vector<int> idx; for(int i=0;i<len;i++)idx.pb(i); idx.pb(n); for(int i=len-1;i>-1;i--){ if(s>=l)break; idx[i]=idx[i+1]-1; s-=v[i].fs; s+=v[idx[i]].fs; } idx.pop_back(); for(int &i:idx)i=v[i].sc; return idx; } return std::vector<int>(0); }

Compilation message (stderr)

molecules.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> find_subset(int l, int u, std::vector<int> w) {
      |      ^~~~~~
molecules.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<int> find_subset(int l, int u, std::vector<int> w) {