#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
bool dp[N];
int bk[N];
int n;
vector<int> find_subset(int l, int u, vector<int> w) {
n=w.size();
vector<int> ans;
dp[0]=true;
for(int i=0;i<n;i++){
for(int j=u;j>=0;j--){
if(j-w[i]>=0){
if(!dp[j] && dp[j-w[i]]){
dp[j]|=dp[j-w[i]];
bk[j]=i;
}
}
}
}
for(int i=l;i<=u;i++){
if(dp[i]){
int tmp=i;
while(1){
if(tmp==0) break;
ans.push_back(bk[tmp]);
tmp=bk[tmp];
}
break;
}
}
/*for(int i=0;i<ans.size();i++) cout<<ans[i] <<" ";
cout<<"\n\n\n";*/
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [15..15] but it is 10 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
sum of weights should be in [302..304] but it is 101 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [15..15] but it is 10 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [15..15] but it is 10 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [15..15] but it is 10 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
440 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [15..15] but it is 10 |
8 |
Halted |
0 ms |
0 KB |
- |