#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+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++){
int tmp=i;
//cout<<i <<"\n\n\n\n";
while(1){
if(tmp==0) break;
ans.push_back(bk[tmp]);
tmp-=w[bk[tmp]];
}
break;
}
/*for(int i=0;i<ans.size();i++) cout<<ans[i] <<" ";
cout<<"\n\n\n";*/
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
3 |
Runtime error |
99 ms |
65536 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
89 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |