이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <algorithm>
using namespace std;
typedef long long llong;
struct mole {
int x, i;
bool operator<(const mole &p) const {
return x < p.x;
}
};
int n;
vector<mole> arr;
llong sum[200001];
vector<int> ret;
vector<int> find_subset(int l, int u, vector<int> w) {
arr.resize((n = w.size()) + 1);
arr[0] = { 0, -1 };
for (int i = 0; i < n; ++i) {
arr[i + 1] = { w[i], i };
}
sort(arr.begin() + 1, arr.end());
for (int i = 1; i <= n; ++i) {
sum[i] = sum[i - 1] + arr[i].x;
}
for (int i = 1; i <= n; ++i) {
llong pre, post;
pre = sum[i];
post = sum[n] - sum[n - i];
if (pre < l && post < l) continue;
if (u < pre && u < post) continue;
for (int j = 0;; ++j) {
llong in = sum[j + i] - sum[j];
if (l <= in && in <= u) {
for (int k = 1; k <= i; ++k)
ret.push_back(arr[j + k].i);
return ret;
}
}
}
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... |