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 "molecules.h"
#include<bits/stdc++.h>
using namespace std;
int L,U,n,a[200010],id[200020],pre[200010],su[200010];
bool cmp(int x, int y){
return a[x]<a[y];
}
vector<int> find_subset(int l, int u, vector<int> w) {
n=w.size();
for(int i=0; i<n; i++){
a[i]=w[i];
id[i]=i;
}
sort(id, id+n, cmp);
for(int i=0; i<n; i++)cout<<id[i]<<" ";
cout<<endl;
for(int i=1; i<=n; i++){
pre[i]=pre[i-1]+a[id[i-1]];
}
for(int i=n; i>=1; i--){
su[i]=su[i+1]+a[id[i-1]];
}
for(int i=1; i<=n; i++) cout<<su[i]<<" ";
cout<<endl;
int low=0, high=n+1;
while(high - low >= 2){
int mid = (high + low) / 2;
if(pre[mid]>l) high = mid;
else low = mid;
}
printf("%d, %d \n",high, low);
high=low;
for(int i=0; i<high; i++){
cout<<pre[i]+su[n-high+i+1]<<" "<<(pre[i]+su[n-high+i+1]>=l)<<" "<<(pre[i]+su[n-high+i+1]<=u)<<endl;
if(pre[i]+su[n-high+i+1]>=l&&pre[i]+su[n-high+i+1]<=u){
vector<int> v;
for(int j=1; j<=i; j++){
v.push_back(id[j]);
}
for(int j=n-high+i+1; j<=n; j++){
v.push_back(id[j]);
}
return v;
}
}
return vector<int>(0);
}
# | 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... |