Submission #536450

#TimeUsernameProblemLanguageResultExecution timeMemory
536450timreizinDetecting Molecules (IOI16_molecules)C++17
69 / 100
1086 ms6532 KiB
#include "molecules.h" #include <algorithm> using namespace std; using ll = long long; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pair<ll, int>> a(n); for (int i = 0; i < n; ++i) a[i] = {w[i], i}; sort(a.begin(), a.end()); for (int i = 0; i < n; ++i) { ll sum = 0; vector<int> res; for (int j = i; j < n; ++j) { sum += a[j].first; res.push_back(a[j].second); if (sum >= l && sum <= u) return res; } } return vector<int>(0); }
#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...