#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define el "\n"
#define pb push_back
#define pp pop_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define ibase ios_base::sync_with_stdio(0), cin.tie(0);
const int N = 5e5 + 5, M = 1e3 + 5, pw = 31;
const ll MAX = 1e15, inf = 1e9 + 7;
vector <int> find_subset(int l, int u, vector <int> a) {
int n = a.size();
pair <int, int> p[n];
for (int i = 0; i < n; i++) {
p[i] = {a[i], i};
}
sort(p, p + n);
ll sum = 0, j = 0, last = 0;
for (int i = 0; i < n; i++) {
sum += p[i].x;
last = i;
if (sum >= l && sum <= u) {
break;
}
else if (sum >= l) {
j = 0;
while (sum > u)
sum -= p[j++].x;
break;
}
}
if (l > sum || sum > u)
return {};
vector <int> ans;
for (int i = j; i <= last; i++)
ans.pb(p[i].y);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
344 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
600 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
344 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
600 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
344 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
344 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
600 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
344 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
344 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
600 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
344 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
344 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
600 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
344 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |