#include <bits/stdc++.h>
using namespace std;
vector<int>arr;
int n;
int dp[105][1005];
int f(int idx,int x,vector<int>vec,vector<int>weight)
{
if(idx==n)
{
arr=vec;
return 0;
}
if(dp[idx][x]!=-1)return dp[idx][x];
int rez=0;
rez=max(rez, f(idx+1,x,vec,weight));
vector<int>pom;
pom=vec;
pom.push_back(idx);
if(x-weight[idx]>=0)
rez=max(rez, f(idx+1,x-weight[idx],pom,weight)+weight[idx]);
return dp[idx][x]=rez;
}
vector<int> find_subset(int l, int u, vector<int> w)
{
memset(dp,-1,sizeof dp);
vector<int>v;
queue<int>Q;
n=w.size();
int kol=f(0,u,v,w);
if(kol<l)
{
return {};
}
return arr;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
596 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
724 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
2 ms |
724 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
sum of weights should be in [302..304] but it is 300 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
596 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
724 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
2 ms |
724 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
596 KB |
sum of weights should be in [302..304] but it is 300 |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
596 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
724 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
2 ms |
724 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
596 KB |
sum of weights should be in [302..304] but it is 300 |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
596 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
724 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
2 ms |
724 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
596 KB |
sum of weights should be in [302..304] but it is 300 |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
596 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
596 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
596 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
596 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
596 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
724 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
2 ms |
724 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
596 KB |
sum of weights should be in [302..304] but it is 300 |
21 |
Halted |
0 ms |
0 KB |
- |