이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"molecules.h"
#include"bits/stdc++.h"
using namespace std;
using ll = long long;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<ll, int>> v;
for (int i = 0; i < (int)w.size(); ++i) {
v.push_back({w[i], i});
}
deque<int> dq;
sort(v.begin(), v.end());
ll sum = 0;
int i = 0;
while (sum < l) {
sum += v[i].first;
dq.push_back(v[i].first);
++i;
}
int end = i;
i = 0;
while (sum > u and !dq.empty()) {
sum -= dq.front();
dq.pop_front();
++i;
}
vector<int> ret;
if (sum > u or sum < l) return ret;
for (; i < end; ++i) {
ret.push_back(v[i].second);
}
sort(ret.begin(), ret.end());
return ret;
}
/*
int main() {
int l, r, n;
cin >> l >> r >> n;
vector<int> v(n);
for (auto &x : v) cin >> x;
v = find_subset(l, r, v);
for (auto x : v) cout << x << " ";
}
*/
# | 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... |