이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
const int MAXN = (int)1e6 + 7;
const ll INF = (ll)1e18 + 7;
int n, m, tmp, tmp2, ans;
vector<pii> vec;
ll ps[MAXN];
set<ll> st;
vector<int> find_subset(int l, int u, vector<int> w) {
n = w.size();
vec.clear(); st.clear();
vector<int> res;
for (int i=0; i<n; i++) vec.pb(mp(w[i], i+1));
sort(all(vec));
ps[0] = 0;
for (int i=1; i<=n; i++) {
ps[i] = ps[i-1]+vec[i-1].F;
st.insert(ps[i]);
}
st.insert(INF);
for (int i=1; i<=n; i++) {
if ((*st.lower_bound(ps[i-1]+l)) <= ps[i-1]+u) {
ans = 0;
for (int j=i; ; j++) {
ans += vec[j-1].F; res.pb(vec[j-1].S);
if (ans >= l) return res;
}
}
}
return 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... |