이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
vector<int> find_subset(int l, int u, vector<int> w1) {
vector<ll> cvb;
ll n=w1.size(), i, c1=-1, c2=-1;
vector<pair<ll, ll>> w;
w.push_back({0, 0});
for(i=0; i<n; i++){
w.push_back({w1[i], i+1});
}
sort(w.begin(), w.end());
vector<ll> v(n+1, 0);
for(i=1; i<=n; i++){
v[i]=v[i-1]+w[i].first;
}
for(i=1; i<=n; i++){
ll lo=i, hi=n;
while(lo<hi){
ll mid=(lo+hi)/2;
if(v[mid]-v[i]<l) lo=mid+1;
else if(v[mid]-v[i]>u) hi=mid-1;
else {
c1=i, c2=mid;
break;
}
}
}
if(c1==-1) return cvb;
for(i=c1; i<=c2; i++){
cvb.push_back(w[i].second-1);
}
return cvb;
}
# | 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... |