이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct po{
int fi;
int se;
po(int _x=0,int _y=0){
fi=_x;se=_y;
}
bool operator<(const po&oth){
return fi<oth.fi;
}
};
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
long long sum=0;
po e;
vector<po> all;
int n=w.size();
for(int i=0;i<n;++i)all.push_back(po(w[i],i));
sort(all.begin(),all.end());
int le=0;
int r=-1;
while(true){
while(r<n&&sum<l){
sum+=all[++r].fi;
}
if(r==n&&sum<l){
break;
}
if(sum>=l&&sum<=u){
vector<int> ans;
for(int j=le;j<=r;++j){
ans.push_back(all[j].se);
}
// cout<<sum<<" "<<le<<" "<<r<<endl;
return ans;
}
sum-=all[le++].fi;
}
return std::vector<int>();
}
# | 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... |