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>
#define ll long long
#define all(a) a.begin(),a.end()
#define mp make_pair
#define F first
#define S second
#define pii pair<long long ,int>
using namespace std;
vector<int> find_subset(int l , int r , vector<int> a){
int n = a.size() ;
vector<pii> w(n) ;
ll sum = 0 ;
for(int i=0;i<n;i++){
w[i].F=a[i] ;
sum+=a[i] ;
w[i].S =i ;
}
sort(all(w)) ;
vector<int> poop ;
//for(int i=1;i<n;i++) w[i].F+=w[i-1].F ;
sum=0 ;
int L = 0 , R= 0 ;
while(R<n){
sum+=w[R].F ;
while(sum>r){
sum-= w[L].F ;
L++;
}
if(l<=sum&&sum<=r) break ;
R++ ;
}
// vector<int> poop ;
if(R==n) return poop ;
for(int i=L;i<=R;i++)poop.push_back(w[i].S) ;
return poop ;
}
# | 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... |