Submission #867489

#TimeUsernameProblemLanguageResultExecution timeMemory
867489lolismekDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <queue> using namespace std; vector<int> find_subset(int l, int u, vector<int> w){ queue <int> dq; long long sum = 0; sort(w.begin(), w.end()); for(int i = 0; i < (int)w.size(); i++){ sum += w[i]; dq.push(i); while(!dq.empty() && sum > u){ sum -= w[dq.front()]; dq.pop(); } if(l <= sum && sum <= u){ vector <int> ans; while(!dq.empty()){ ans.push_back(dq.front()); dq.pop(); } return ans; } } return {}; } /* 4 15 17 6 8 8 7 */

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   12 |     sort(w.begin(), w.end());
      |     ^~~~
      |     qsort