이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define lnl long long
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define F first
#define S second
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int, int>> ww;
int n = w.size();
lnl sum = 0;
for (int i = 0; i < n; i++) {sum += w[i]; ww.pb({w[i], i});}
sort(all(ww));
vector<int> id;
for (int i = n - 1, j = n; i < j && i >= -1;)
{
while (sum > u && i >= 0) {sum -= ww[i].F; i--;}
if (l <= sum && sum <= u) {
for (int p = 0; p <= i; p++) id.pb(ww[p].S);
for (int p = j; p < n; p++) id.pb(ww[p].S);
return id;
}
j--; sum += ww[j].F;
}
return vector<int>(0);
}
# | 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... |