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 <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
vi find_subset(int L, int U, vi W)
{
int N = W.size();
vector<pii> A(N);
vi used(N), ans;
for(int i = 0; i < N; i++)
A[i] = {W[i], i};
sort(A.begin(), A.end());
if(A[0].first > U)
return ans;
int rpnt = 0, sum = 0;
for(int lpnt = 0; lpnt < N; lpnt++)
{
for(; rpnt < N; rpnt++)
{
if(sum + A[rpnt].first > U)
break;
used[A[rpnt].second] = 1;
sum += A[rpnt].first;
}
//[lpnt, rpnt)
if ( L <= sum )
{
for(int i = 0; i < N; i++)
if(used[i])
ans.push_back(i);
return ans;
}
sum -= A[lpnt].first;
used[A[lpnt].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... |