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>
using namespace std;
using i64 = long long;
using pii = pair<int,int>;
using pli = pair<i64,int>;
#define sz(a) (int)a.size()
#define eb emplace_back
#define all(a) a.begin(),a.end()
vector<int> find_subset(int l, int r, vector<int> a){
int n = sz(a);
vector<pii> res;
for(int i=0;i<n;i++)
res.eb(a[i],i);
sort(all(res));
vector<pli> sum(n+1,{0,0});
for(int i=0;i<n;i++){
sum[i+1].first=sum[i].first+res[i].first;
sum[i+1].second=res[i].second;
}
vector<int> ans;
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
i64 res=sum[j].first-sum[i-1].first;
if(l<=res and res<=r){
for(int k=i;k<=j;k++)
ans.eb(sum[k].second);
sort(all(ans));
return ans;
}
}
}
sort(all(ans));
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... |