이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef string str;
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
vector <int> find_subset(int l, int u, vector <int> w) {
deque <int> d;
ll cur = 0;
vector <pair <int, int>> v;
for (int i = 0; i < sz(w); i++) {
v.pb({w[i], i + 1});
}
sort(all(v));
int tl = 0, tr = 0;
while (tr < sz(w)) {
if (cur < l) {
cur += v[tr].F;
d.pb(v[tr].S);
tr++;
}
if (cur > u) {
cur -= v[tl].F;
d.ppf();
tl++;
}
if (cur >= l && cur <= u) {
break;
}
}
if (cur >= l && cur <= u) {
return vector <int> (all(d));
}
return vector <int> (0);
}
# | 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... |