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;
typedef pair<int, int> pi;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
vector<int> sol;
int n = w.size();
vector<pi> v(n);
for (int i=0; i<n; i++) v[i] = {w[i], i};
sort(v.begin(), v.end());
int j = 0;
int sum = 0;
for (int i=0; i<n; i++)
{
while(j < n && sum<l)
{
sum += v[j].first;
j++;
}
if(sum>=l && sum<=u)
{
for (int k=i; k<j; k++) sol.push_back(v[k].second);
//cout << "i: "<<i<<" j: "<<j<<endl;
return sol;
}
else sum -= v[i].first;
}
return sol;
}
# | 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... |