이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pii pair <int, int >
#define f first
#define s second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);}
#else
#define bug(...)
#endif // BALBIT
#define pb push_back
#define REP(i,n) for (int i = 0; i<(n); ++i)
#define REP1(i,n) for (int i = 1; i<=(n); ++i)
std::vector<signed> find_subset(signed l, signed u, std::vector<signed> w) {
vector <int> id;
int n = SZ(w);
sort(ALL(id), [&](int a, int b){return w[a] < w[b];});
int j = -1;
ll s = 0;
for (int i = 0; i<n; ++i) {
while (s < l) {
if (j+1 == n) return {};
++j;
s += w[id[j]];
}
if (s >= l && s <= u) {
vector<signed> ret;
for (int k = i; k<=j; ++k) {
ret.pb(id[k]);
}
return ret;
}
s -= w[id[i]];
}
return {};
}
# | 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... |