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 "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<int> find_subset(int l, int u, vector<int> w)
{
int n = w.size();
vector<pair<ll, int>> s;
for (int i = 0; i < n; i++)
s.push_back({w[i], i});
sort(s.begin(), s.end());
vector<bool> vis(n, 0);
vector<int> ans;
ll sum = 0, j = 0;
for (int i = 0; i < n; i++)
{
while (j < n && sum < l)
{
sum += s[j].first;
vis[s[j].second] = 1;
j++;
}
if (sum >= l && sum <= u)
{
for (int i = 0; i < n; i++)
{
if (vis[i])
ans.push_back(i);
}
break;
}
sum -= s[i].first;
vis[s[i].second] = 0;
}
return ans;
}
# | 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... |