Submission #956140

#TimeUsernameProblemLanguageResultExecution timeMemory
956140manishjha91Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
std::vector<int> find_subset(int l, int u, std::vector<int> w) { std::vector<pair<int,int>> curr; for(int i=0; i<w.size(); i++) { curr.push_back({w[i],i}); } sort(curr.begin(),curr.end()); long long sum = 0; bool found = 0; int low = 0; int hi = 0; for(; hi<curr.size(); hi++) { sum+=curr[hi].first; while(sum>u) { sum-=curr[low++].first; } if(sum>=l) { found = 1; break; } } if(!found) return std::vector<int>(0); std::vector<int> res; for(int i=low; i<=hi; i++) { res.push_back(curr[i].second); } sort(res.begin(),res.end()); return res; }

Compilation message (stderr)

molecules.cpp:2:6: error: 'vector' in namespace 'std' does not name a template type
    2 | 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 |