Submission #781792

#TimeUsernameProblemLanguageResultExecution timeMemory
781792acatmeowmeowDetecting Molecules (IOI16_molecules)C++11
69 / 100
34 ms4940 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { ios::sync_with_stdio(false); cin.tie(nullptr); int n = w.size(); vector<pair<int, int>> arr(n); for (int i = 0; i < n; i++) arr[i] = {w[i], i}; sort(arr.begin(), arr.end()); for (int i = 0, j = 0, sum = 0; i < n; i++) { sum += arr[i].first; while (sum > u && j < i) sum -= arr[j++].first; if (l <= sum && sum <= u) { vector<int> ans; for (int k = j; k <= i; k++) ans.push_back(arr[k].second); return ans; } } 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...