# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239253 | 2020-06-15T01:56:37 Z | urd05 | Detecting Molecules (IOI16_molecules) | C++14 | 5 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; bool dp[101][1001]; vector<int> find_subset(int l, int u,vector<int> w) { dp[0][0]=true; for(int i=0;i<w.size();i++) { int ind=i+1; for(int j=0;j<=u-w[i];j++) { dp[ind][j+w[i]]|=dp[ind-1][j]; dp[ind][j]|=dp[ind-1][j]; } } int n=w.size(); int pos=-1; for(int i=l;i<=u;i++) { if (dp[n][i]) { pos=i; } } if (pos==-1) { vector<int> emp; return emp; } vector<int> ret; int sum=pos; for(int i=n-1;i>=0;i--) { if (sum>=w[i]&&dp[i][sum-w[i]]) { ret.push_back(i+1); sum-=w[i]; } } return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 4 ms | 256 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Integer 12 violates the range [0, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 4 ms | 256 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 4 ms | 256 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 4 ms | 256 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 4 ms | 256 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |