# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102055 | 2019-03-22T00:59:49 Z | daniel920712 | Detecting Molecules (IOI16_molecules) | C++14 | 4 ms | 896 KB |
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <vector> #include "molecules.h" using namespace std; bool have[105][1005]={0}; bool can[105][1005][5]={0}; bool F(int N,int l,int r,vector < int > &w) { if(r<0) return 0; if(l<=0&&0<=r) return 1; if(l<=w[N]&&w[N]<=r) return 1; if(N==0) return 0; if(have[N][r]) return can[N][r][0]||can[N][r][1]; can[N][r][0]=F(N-1,l,r,w); can[N][r][1]=F(N-1,l-w[N],r-w[N],w); have[N][r]=1; return can[N][r][0]||can[N][r][1]; } void solve(int N,int l,int r,vector < int > &ans,vector < int > &w) { //printf("%d %d %d\n",N,l,r); if(r<0) return; if(l<=0&&0<=r) return; if(l<=w[N]&&w[N]<=r) { ans.push_back(N); return; } if(N==0) return; if(can[N][r][0]) solve(N-1,l,r,ans,w); else { ans.push_back(N); solve(N-1,l-w[N],r-w[N],ans,w); } } vector < int > find_subset(int l, int u, vector < int > w) { int N=w.size(); vector < int > ans; if(F(N-1,l,u,w)) solve(N-1,l,u,ans,w); return ans; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 768 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
2 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
3 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
4 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
5 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
6 | Correct | 2 ms | 428 KB | OK (n = 12, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
8 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 6, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
11 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
12 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
13 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
14 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
15 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
16 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
17 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 768 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 428 KB | OK (n = 12, answer = YES) |
26 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
27 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 384 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
30 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
31 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
33 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
34 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
35 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
36 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 512 KB | OK (n = 28, answer = YES) |
38 | Correct | 3 ms | 512 KB | OK (n = 27, answer = YES) |
39 | Correct | 4 ms | 896 KB | OK (n = 90, answer = YES) |
40 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
41 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
42 | Correct | 3 ms | 384 KB | OK (n = 10, answer = YES) |
43 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
44 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
45 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
46 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
47 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
48 | Correct | 2 ms | 768 KB | OK (n = 100, answer = NO) |
49 | Correct | 2 ms | 896 KB | OK (n = 100, answer = NO) |
50 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
51 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
52 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
53 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
54 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 768 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 428 KB | OK (n = 12, answer = YES) |
26 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
27 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 384 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
30 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
31 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
33 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
34 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
35 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
36 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 512 KB | OK (n = 28, answer = YES) |
38 | Correct | 3 ms | 512 KB | OK (n = 27, answer = YES) |
39 | Correct | 4 ms | 896 KB | OK (n = 90, answer = YES) |
40 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
41 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
42 | Correct | 3 ms | 384 KB | OK (n = 10, answer = YES) |
43 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
44 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
45 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
46 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
47 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
48 | Correct | 2 ms | 768 KB | OK (n = 100, answer = NO) |
49 | Correct | 2 ms | 896 KB | OK (n = 100, answer = NO) |
50 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
51 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
52 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
53 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
54 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
55 | Runtime error | 4 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
56 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 768 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 428 KB | OK (n = 12, answer = YES) |
26 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
27 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 384 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
30 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
31 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
33 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
34 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
35 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
36 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 512 KB | OK (n = 28, answer = YES) |
38 | Correct | 3 ms | 512 KB | OK (n = 27, answer = YES) |
39 | Correct | 4 ms | 896 KB | OK (n = 90, answer = YES) |
40 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
41 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
42 | Correct | 3 ms | 384 KB | OK (n = 10, answer = YES) |
43 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
44 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
45 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
46 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
47 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
48 | Correct | 2 ms | 768 KB | OK (n = 100, answer = NO) |
49 | Correct | 2 ms | 896 KB | OK (n = 100, answer = NO) |
50 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
51 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
52 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
53 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
54 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
55 | Runtime error | 4 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
56 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 128 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 768 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 428 KB | OK (n = 12, answer = YES) |
26 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
27 | Correct | 3 ms | 384 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 384 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
30 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
31 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
33 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
34 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
35 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
36 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 512 KB | OK (n = 28, answer = YES) |
38 | Correct | 3 ms | 512 KB | OK (n = 27, answer = YES) |
39 | Correct | 4 ms | 896 KB | OK (n = 90, answer = YES) |
40 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
41 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
42 | Correct | 3 ms | 384 KB | OK (n = 10, answer = YES) |
43 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
44 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
45 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
46 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
47 | Correct | 3 ms | 896 KB | OK (n = 100, answer = NO) |
48 | Correct | 2 ms | 768 KB | OK (n = 100, answer = NO) |
49 | Correct | 2 ms | 896 KB | OK (n = 100, answer = NO) |
50 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
51 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
52 | Correct | 4 ms | 896 KB | OK (n = 100, answer = YES) |
53 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
54 | Correct | 3 ms | 896 KB | OK (n = 100, answer = YES) |
55 | Runtime error | 4 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
56 | Halted | 0 ms | 0 KB | - |