이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ff first
#define sc second
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w){
long long sz = w.size(), sum = 0;
vector<pair<int, int>> vec;
for(int i = 0; i < sz; i++) vec.push_back({w[i], i});
sort(vec.begin(), vec.end());
vector<int> ans;
int L = 0, R = 0;
while(R<sz&&L<sz){
while(sum<l&&R<sz) sum += vec[R++].ff;
while(sum>u&&L<sz) sum -= vec[L++].ff;
if(sum<=u&&sum>=l){
for(int i = L; i < R; i++) ans.push_back(vec[i].sc);
sort(ans.begin(), ans.end()); return ans;
}
}
return {};
}
# | 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... |