#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define x first
#define y second
#define ld long double
#define ll long long
using namespace std;
vector <int> find_subset(int l, int u, vector <int> w) {
int n = w.size();
vector <pair <int, int>> v;
vector <ll> s(n + 1);
vector <int> ans;
for(int i = 0; i < n; i++)
v.push_back({w[i], i});
sort(v.begin(), v.end());
for(int i = 0; i < n; i++)
s[i + 1] = s[i] + v[i].first;
for(int i = 1; i <= n; i++) {
int j = lower_bound(s.begin(), s.begin() + i, s[i] - u) - s.begin();
if(s[i] >= s[j] + l) {
for(int k = j + 1; k <= i; k++)
ans.push_back(v[k].second);
break;
}
}
return ans;
}
/*int main() {
ios_base :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, l, u, x;
vector <int> v;
cin >> n >> l >> u;
for(int i = 1; i <= n; i++)
cin >> x, v.push_back(x);
vector <int> ans = find_subset(l, u, v);
int sum = 0;
for(auto &i : ans)
sum += v[i];
if(sum == 0 || (l <= sum && sum <= u))
cout << "Accepted!";
else {
cout << "Wrong answer, sum = " << sum << " and subset is ";
for(auto &i : ans)
cout << i << " ";
}
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [290..300] but it is 301 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [290..300] but it is 301 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [290..300] but it is 301 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [290..300] but it is 301 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Incorrect |
1 ms |
256 KB |
sum of weights should be in [290..300] but it is 301 |
25 |
Halted |
0 ms |
0 KB |
- |