# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997103 | codefox | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<pii> nums;
for (int i = 0; i < w.size(); i++) nums.push_back({w[i], i});
sort(nums.begin(), nums.end());
int left=0, right=0;
long long sum = 0;
while (sum < l)
{
sum += nums[right].first;
right++;
}
right--;
sum -= nums[right].first;
while (sum <= u)
{
sum += nums[right].first;
right++;
sum -= nums[left].first;
left++;
}
right--;
sum -= nums[right].first;
left--;
sum += nums[left].first;
if (sum >= l)
{
vector<int> ans(right-left);
for (int i = left; i < right; i++)
{
ans[i-left] = nums[i].second;
}
return ans;
}
else
{
vector<int> ans(0);
return ans;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |