이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200005
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
typedef long long LL;
int N;
int A[MAXN];
LL S[MAXN];
vector<int> find_subset(int l, int u, vector<int> w)
{
int t = 0;
N = sz(w);
for (int i=1;i<=N;i++) A[i] = i;
sort(A+1, A+N+1, [&w](const int &a, const int &b){
return w[a-1] < w[b-1];
});
for (int i=1;i<=N;i++)
S[i] = S[i-1] + w[A[i]-1];
for (int i=1;i<=N;i++){
LL p = S[i];
LL q = S[N]-S[N-i];
if (p <= u && q >= l){ t = i; break; }
}
vector <int> ret;
if (!t) return ret;
for (int i=t;i<=N;i++){
LL v = S[i] - S[i-t];
if (v < l || v > u) continue;
for (int j=0;j<t;j++) ret.pb(A[i-j]-1);
break;
}
return ret;
}
# | 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... |