This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |