# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262180 | 2020-08-12T12:54:32 Z | stoyan_malinin | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 384 KB |
#include "molecules.h" //#include "grader.cpp" #include <bitset> #include <cstring> using namespace std; const int MAXN = 1e4 + 5; int dp[MAXN]; vector<int> find_subset(int l, int u, vector <int> w) { memset(dp, -1, sizeof(dp)); dp[0] = -2; for(int i = 0;i<w.size();i++) { for(int j = u-w[i];j>=0;j--) { if(dp[j]!=-1) dp[ j + w[i] ] = i; } } for(int i = l;i<=u;i++) { if(dp[i]!=-1) { vector <int> answer; int x = i; while(x!=0) { answer.push_back(dp[x]); x = x - w[ dp[x] ]; } return answer; } } return vector <int> {}; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 384 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | item #11 is taken twice |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 384 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 384 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 384 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 384 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 384 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |