Submission #867492

#TimeUsernameProblemLanguageResultExecution timeMemory
867492lolismekDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms348 KiB
#include "molecules.h" #include <algorithm> #include <iostream> #include <queue> #include <cassert> 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); if(l <= sum && sum <= u){ break; } while(!dq.empty() && sum > u){ sum -= w[dq.front()]; dq.pop(); } } if(sum < l || sum > u){ return vector <int>(0); } vector <int> ans; while(!dq.empty()){ ans.push_back(dq.front()); dq.pop(); } return ans; } /* 4 15 17 6 8 8 7 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...