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>
#include"molecules.h"
using namespace std;
typedef long long int lld;
typedef pair<int, int> pii;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pii> p;
vector<int> rst;
vector<lld> S;
int a = 0, b = 0;
for (int i = 0; i < (int)w.size(); i++)
p.push_back(pii(w[i], i));
sort(p.begin(), p.end());
S.push_back(p[0].first);
for (int i = 1; i < (int)p.size(); i++)
S.push_back(S[i-1] + p[i].first);
for (int i = 1; i < (int)p.size(); i++) {
lld t = S[i] - u;
int j = lower_bound(S.begin(), S.end(), t) - S.begin();
if (S[i] - S[j] >= l) {
a = j;
b = i;
break;
}
}
for (int i = a; i <= b; i++)
rst.push_back(p[i].second);
return rst;
}
# | 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... |