이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
long long N, L, R, A[200009], id[200009];
vector<int> solve(int pos) {
long long sum = 0;
for (int i = 0; i < pos; i++) sum += A[i];
if (L <= sum && sum <= R) {
vector<int> X; for (int i = 0; i < pos; i++) X.push_back(id[i]);
return X;
}
for (int i = pos - 1; i >= 0; i--) {
sum -= A[i];
sum += A[i + (N - pos)];
if (L <= sum && sum <= R) {
vector<int> X;
for (int j = 0; j < i; j++) X.push_back(id[j]);
for (int j = i + (N - pos); j < N; j++) X.push_back(id[j]);
return X;
}
}
return vector<int>{};
}
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int, int>> G; N = w.size(); L = l; R = u;
for (int i = 0; i < N; i++) G.push_back(make_pair(w[i], i));
sort(G.begin(), G.end());
for (int i = 0; i < N; i++) { A[i] = G[i].first; id[i] = G[i].second; }
for (int i = 1; i <= N; i++) {
vector<int> G = solve(i);
if (G.size() >= 1) return G;
}
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... |