Submission #997140

#TimeUsernameProblemLanguageResultExecution timeMemory
997140codefoxDetecting Molecules (IOI16_molecules)C++14
46 / 100
3 ms584 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(n); for (int i = 0; i < n; i++) nums[i] = {w[i], i}; sort(nums.begin(), nums.end()); long long sum = 0; int r = 0; for (int i = 0; i < n; i++) { while (sum < l) { sum += nums[r].first; r++; } if (sum <= u) { vector<int> ans; for (int j = i; j < min(r, n); j++) { ans.push_back(nums[j].second); } return ans; } sum -= nums[i].first; } 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...