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<i64> sum(n+1,0);
for(int i=0;i<n;i++)
sum[i+1]=sum[i]+res[i].first;
vector<int> ans;
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
i64 temp=sum[j]-sum[i-1];
if(l<=temp and temp<=r){
for(int k=i;k<=j;k++)
ans.eb(res[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... |