#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[pos];
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>{};
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |