Submission #997116

#TimeUsernameProblemLanguageResultExecution timeMemory
997116codefoxDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms436 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int, int> vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pii> nums; for (int i = 0; i < n; i++) nums.push_back({w[i], i}); sort(nums.begin(), nums.end()); int lefts=n, rights=n; long long sum = 0; while (sum <= u) { lefts--; sum += nums[lefts].first; } sum -= nums[lefts].first; lefts++; while (sum > u) { rights--; sum -= nums[rights].first; lefts--; sum += nums[lefts].first; } if (sum >= l) { vector<int> ans(rights-lefts); for (int i = lefts; i < rights; i++) { ans[i-lefts] = nums[i].second; } return ans; } else { vector<int> ans(0); return ans; } }
#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...