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 <stdio.h>
#include <algorithm>
using namespace std;
struct point{
int a, num;
bool operator<(const point &p)const{
return a<p.a;
}
}P[201000];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int i, n = w.size(), j, k;
long long S1 = 0, S2 = 0;
for(i=0;i<n;i++)P[i].num=i,P[i].a=w[i];
sort(P,P+n);
vector<int>res;
for(i=0;i<n;i++){
S1 += P[i].a;
S2 += P[n-i-1].a;
if(S1 <= u && S2 >= l){
if(S1 >= l){
for(j=0;j<=i;j++)res.push_back(P[j].num);
return res;
}
for(j=i+1;j<n;j++){
S1 += P[j].a;
S1 -= P[j-i-1].a;
if(S1 >= l){
for(k=j-i;k<=j;k++)res.push_back(P[k].num);
return res;
}
}
}
}
return res;
}
# | 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... |