이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "molecules.h"
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define ll long long
using namespace std;
int N, r;
vector<pii> A;
vector<int> find_subset(int l, int u, vector<int> w) {
r=u;
vector<int> ans, MT;
queue<pii> take;
ll tot=0;
N=w.size();
for(int i=0; i<N; i++){
A.pb({w[i], i});
tot+=w[i];
}
if(tot<l)
return MT;
sort(A.begin(), A.end());
if(r<A[0].fi)
return MT;
if(A[0].fi<=r && r<=A.back().fi){
ans.pb(A[0].se);
return ans;
}
if(A[0].fi<l && l<=A.back().fi){
ans.pb(A.back().se);
return ans;
}
tot=0;
for(int i=0; i<N; i++){
tot+=A[i].fi;
take.push(A[i]);
while(tot>r){
tot-=take.front().fi;
take.pop();
}
if(l<=tot && tot<=r){
while(take.size()){
ans.pb(take.front().se);
take.pop();
}
return ans;
}
}
return MT;
}
# | 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... |