이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = w.size();
pair<int,int> W2 [n+1];
vector<int> ans;
for(int i = 0; i < n; i++) {
W2[i].fi = w[i];
W2[i].se = i;
}
sort(W2, W2+n);
long long sum = W2[0].fi;
int L = 0, R = 1;
while(L < R && L < n && R <= n)
{
if(sum < l)
{
sum += W2[R].fi;
R++;
}
else if(sum>u)
{
sum -= W2[L].fi;
L++;
}
else
{
for(int p = L; p < R; p++)
ans.pb(W2[p].se);
return ans;
}
}
return ans;
}
# | 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... |