#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> p;
const int N = 2e5+45;
int n,a[N];
p go[105][10002];
p dp[105][10002];
vector <int> sol;
vector <int> find_subset(int l,int u,vector <int> w){
n = w.size();
for(int i = 0; i < n; i++){
a[i+1] = w[i];
}
dp[0][0] = p(1,0);
for(int i = 1; i <= n; i++){
dp[i][0] = p(1,0);
for(int j = 1; j <= 30; j++){
if(dp[i-1][j].first){
dp[i][j] = p(1,0);
go[i][j] = p(i-1,j);
}
if(j >= a[i] && dp[i-1][j-a[i]].first){
dp[i][j] = p(1,1);
go[i][j] = p(i-1,j-a[i]);
}
//cout << i << " " << j << " " << dp[i][j].first << endl;
}
}
p poc = p(0,0);
for(int j = l; j <= u; j++){
if(dp[n][j].first){
poc = p(n,j);
break;
}
}
while(poc.first){
if(dp[poc.first][poc.second].second){
sol.push_back(poc.first-1);
}
poc = go[poc.first][poc.second];
}
return sol;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
2 ms |
376 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |