Submission #300722

# Submission time Handle Problem Language Result Execution time Memory
300722 2020-09-17T12:42:37 Z rocks03 Jelly Flavours (IOI20_jelly) C++14
11 / 100
2000 ms 2097152 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int) (x).size())
using namespace std;

int N;
vector<int> v1, v2;
vector<vector<vector<int>>> memo;
int f(int ind, int b1, int b2){
    if(b1 < 0 || b2 < 0)
        return -1;
    if(ind == N){
        return 0;
    }
    if(memo[ind][b1][b2] != -1)
        return memo[ind][b1][b2];
    int ans = 0;
    ans = max(ans, f(ind + 1, b1 - v1[ind], b2) + 1);
    ans = max(ans, f(ind + 1, b1, b2 - v2[ind]) + 1);
    ans = max(ans, f(ind + 1, b1, b2));
    memo[ind][b1][b2] = ans;
    return ans;
}

int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
    v1 = a;
    v2 = b;
    N = SZ(v1);
    memo.resize(N);
    for(int i = 0; i < N; i++){
        memo[i].resize(x+1);
        for(int j = 0; j <= x; j++){
            memo[i][j].resize(y+1);
            for(int k = 0; k <= y; k++)
                memo[i][j][k] = -1;
        }
    }
    return f(0, x, y);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1792 KB Output is correct
2 Correct 6 ms 7168 KB Output is correct
3 Correct 9 ms 7424 KB Output is correct
4 Correct 18 ms 10368 KB Output is correct
5 Correct 11 ms 7936 KB Output is correct
6 Correct 6 ms 6400 KB Output is correct
7 Correct 14 ms 9088 KB Output is correct
8 Correct 6 ms 6272 KB Output is correct
9 Correct 8 ms 8320 KB Output is correct
10 Correct 14 ms 10112 KB Output is correct
11 Correct 2 ms 1152 KB Output is correct
12 Correct 2 ms 1792 KB Output is correct
13 Correct 6 ms 7168 KB Output is correct
14 Correct 7 ms 7424 KB Output is correct
15 Correct 15 ms 10368 KB Output is correct
16 Correct 7 ms 7936 KB Output is correct
17 Correct 6 ms 6400 KB Output is correct
18 Correct 8 ms 9088 KB Output is correct
19 Correct 5 ms 6272 KB Output is correct
20 Correct 8 ms 8320 KB Output is correct
21 Correct 2 ms 1920 KB Output is correct
22 Correct 14 ms 10112 KB Output is correct
23 Correct 2 ms 1920 KB Output is correct
24 Correct 1 ms 256 KB Output is correct
25 Correct 2 ms 1536 KB Output is correct
26 Correct 1 ms 1280 KB Output is correct
27 Correct 1 ms 896 KB Output is correct
28 Correct 3 ms 1920 KB Output is correct
29 Correct 2 ms 1536 KB Output is correct
30 Correct 2 ms 1792 KB Output is correct
31 Correct 4 ms 1408 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 2 ms 1536 KB Output is correct
34 Correct 1 ms 1280 KB Output is correct
35 Correct 2 ms 1024 KB Output is correct
36 Correct 3 ms 1920 KB Output is correct
37 Correct 2 ms 1664 KB Output is correct
38 Correct 2 ms 1664 KB Output is correct
39 Correct 2 ms 1408 KB Output is correct
40 Correct 2 ms 1152 KB Output is correct
41 Correct 3 ms 1792 KB Output is correct
42 Correct 6 ms 7168 KB Output is correct
43 Correct 6 ms 7424 KB Output is correct
44 Correct 13 ms 10368 KB Output is correct
45 Correct 10 ms 7936 KB Output is correct
46 Correct 6 ms 6400 KB Output is correct
47 Correct 12 ms 9088 KB Output is correct
48 Correct 5 ms 6272 KB Output is correct
49 Correct 8 ms 8320 KB Output is correct
50 Correct 12 ms 10112 KB Output is correct
51 Correct 2 ms 1920 KB Output is correct
52 Correct 0 ms 256 KB Output is correct
53 Correct 2 ms 1536 KB Output is correct
54 Correct 1 ms 1280 KB Output is correct
55 Correct 1 ms 896 KB Output is correct
56 Correct 2 ms 1920 KB Output is correct
57 Correct 2 ms 1664 KB Output is correct
58 Correct 2 ms 1664 KB Output is correct
59 Correct 3 ms 1408 KB Output is correct
60 Correct 1 ms 1152 KB Output is correct
61 Correct 3 ms 1792 KB Output is correct
62 Correct 6 ms 7168 KB Output is correct
63 Correct 6 ms 7424 KB Output is correct
64 Correct 13 ms 10368 KB Output is correct
65 Correct 7 ms 7936 KB Output is correct
66 Correct 6 ms 6400 KB Output is correct
67 Correct 8 ms 9088 KB Output is correct
68 Correct 5 ms 6272 KB Output is correct
69 Correct 8 ms 8320 KB Output is correct
70 Correct 13 ms 10112 KB Output is correct
71 Correct 2 ms 1920 KB Output is correct
72 Correct 0 ms 256 KB Output is correct
73 Correct 2 ms 1536 KB Output is correct
74 Correct 1 ms 1280 KB Output is correct
75 Correct 1 ms 896 KB Output is correct
76 Correct 2 ms 1920 KB Output is correct
77 Correct 3 ms 1664 KB Output is correct
78 Correct 2 ms 1664 KB Output is correct
79 Correct 3 ms 1408 KB Output is correct
80 Correct 2 ms 1152 KB Output is correct
81 Correct 2 ms 1792 KB Output is correct
82 Correct 6 ms 7168 KB Output is correct
83 Correct 7 ms 7424 KB Output is correct
84 Correct 13 ms 10368 KB Output is correct
85 Correct 7 ms 7936 KB Output is correct
86 Correct 5 ms 6400 KB Output is correct
87 Correct 8 ms 9088 KB Output is correct
88 Correct 6 ms 6272 KB Output is correct
89 Correct 8 ms 8320 KB Output is correct
90 Correct 12 ms 10112 KB Output is correct
91 Correct 2 ms 1920 KB Output is correct
92 Correct 0 ms 256 KB Output is correct
93 Correct 2 ms 1536 KB Output is correct
94 Correct 1 ms 1280 KB Output is correct
95 Correct 1 ms 896 KB Output is correct
96 Correct 2 ms 1824 KB Output is correct
97 Correct 2 ms 1664 KB Output is correct
98 Correct 2 ms 1792 KB Output is correct
99 Correct 2 ms 1408 KB Output is correct
100 Correct 2 ms 1152 KB Output is correct
101 Correct 2 ms 1792 KB Output is correct
102 Correct 6 ms 7168 KB Output is correct
103 Correct 6 ms 7424 KB Output is correct
104 Correct 13 ms 10368 KB Output is correct
105 Correct 7 ms 7936 KB Output is correct
106 Correct 6 ms 6400 KB Output is correct
107 Correct 8 ms 9088 KB Output is correct
108 Correct 5 ms 6272 KB Output is correct
109 Correct 8 ms 8320 KB Output is correct
110 Correct 12 ms 10112 KB Output is correct
111 Correct 2 ms 1920 KB Output is correct
112 Correct 1 ms 256 KB Output is correct
113 Correct 2 ms 1536 KB Output is correct
114 Correct 1 ms 1280 KB Output is correct
115 Correct 1 ms 928 KB Output is correct
116 Correct 2 ms 1920 KB Output is correct
117 Correct 2 ms 1536 KB Output is correct
118 Correct 2 ms 1664 KB Output is correct
119 Correct 3 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1792 KB Output is correct
2 Correct 6 ms 7168 KB Output is correct
3 Correct 9 ms 7424 KB Output is correct
4 Correct 18 ms 10368 KB Output is correct
5 Correct 11 ms 7936 KB Output is correct
6 Correct 6 ms 6400 KB Output is correct
7 Correct 14 ms 9088 KB Output is correct
8 Correct 6 ms 6272 KB Output is correct
9 Correct 8 ms 8320 KB Output is correct
10 Correct 14 ms 10112 KB Output is correct
11 Correct 2 ms 1152 KB Output is correct
12 Correct 2 ms 1792 KB Output is correct
13 Correct 6 ms 7168 KB Output is correct
14 Correct 7 ms 7424 KB Output is correct
15 Correct 15 ms 10368 KB Output is correct
16 Correct 7 ms 7936 KB Output is correct
17 Correct 6 ms 6400 KB Output is correct
18 Correct 8 ms 9088 KB Output is correct
19 Correct 5 ms 6272 KB Output is correct
20 Correct 8 ms 8320 KB Output is correct
21 Correct 2 ms 1920 KB Output is correct
22 Correct 14 ms 10112 KB Output is correct
23 Correct 2 ms 1920 KB Output is correct
24 Correct 1 ms 256 KB Output is correct
25 Correct 2 ms 1536 KB Output is correct
26 Correct 1 ms 1280 KB Output is correct
27 Correct 1 ms 896 KB Output is correct
28 Correct 3 ms 1920 KB Output is correct
29 Correct 2 ms 1536 KB Output is correct
30 Correct 2 ms 1792 KB Output is correct
31 Correct 4 ms 1408 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 2 ms 1536 KB Output is correct
34 Correct 1 ms 1280 KB Output is correct
35 Correct 2 ms 1024 KB Output is correct
36 Correct 3 ms 1920 KB Output is correct
37 Correct 2 ms 1664 KB Output is correct
38 Correct 2 ms 1664 KB Output is correct
39 Correct 2 ms 1408 KB Output is correct
40 Correct 2 ms 1152 KB Output is correct
41 Correct 3 ms 1792 KB Output is correct
42 Correct 6 ms 7168 KB Output is correct
43 Correct 6 ms 7424 KB Output is correct
44 Correct 13 ms 10368 KB Output is correct
45 Correct 10 ms 7936 KB Output is correct
46 Correct 6 ms 6400 KB Output is correct
47 Correct 12 ms 9088 KB Output is correct
48 Correct 5 ms 6272 KB Output is correct
49 Correct 8 ms 8320 KB Output is correct
50 Correct 12 ms 10112 KB Output is correct
51 Correct 2 ms 1920 KB Output is correct
52 Correct 0 ms 256 KB Output is correct
53 Correct 2 ms 1536 KB Output is correct
54 Correct 1 ms 1280 KB Output is correct
55 Correct 1 ms 896 KB Output is correct
56 Correct 2 ms 1920 KB Output is correct
57 Correct 2 ms 1664 KB Output is correct
58 Correct 2 ms 1664 KB Output is correct
59 Correct 3 ms 1408 KB Output is correct
60 Correct 1 ms 1152 KB Output is correct
61 Correct 3 ms 1792 KB Output is correct
62 Correct 6 ms 7168 KB Output is correct
63 Correct 6 ms 7424 KB Output is correct
64 Correct 13 ms 10368 KB Output is correct
65 Correct 7 ms 7936 KB Output is correct
66 Correct 6 ms 6400 KB Output is correct
67 Correct 8 ms 9088 KB Output is correct
68 Correct 5 ms 6272 KB Output is correct
69 Correct 8 ms 8320 KB Output is correct
70 Correct 13 ms 10112 KB Output is correct
71 Correct 2 ms 1920 KB Output is correct
72 Correct 0 ms 256 KB Output is correct
73 Correct 2 ms 1536 KB Output is correct
74 Correct 1 ms 1280 KB Output is correct
75 Correct 1 ms 896 KB Output is correct
76 Correct 2 ms 1920 KB Output is correct
77 Correct 3 ms 1664 KB Output is correct
78 Correct 2 ms 1664 KB Output is correct
79 Correct 3 ms 1408 KB Output is correct
80 Correct 2 ms 1152 KB Output is correct
81 Correct 2 ms 1792 KB Output is correct
82 Correct 6 ms 7168 KB Output is correct
83 Correct 7 ms 7424 KB Output is correct
84 Correct 13 ms 10368 KB Output is correct
85 Correct 7 ms 7936 KB Output is correct
86 Correct 5 ms 6400 KB Output is correct
87 Correct 8 ms 9088 KB Output is correct
88 Correct 6 ms 6272 KB Output is correct
89 Correct 8 ms 8320 KB Output is correct
90 Correct 12 ms 10112 KB Output is correct
91 Correct 2 ms 1920 KB Output is correct
92 Correct 0 ms 256 KB Output is correct
93 Correct 2 ms 1536 KB Output is correct
94 Correct 1 ms 1280 KB Output is correct
95 Correct 1 ms 896 KB Output is correct
96 Correct 2 ms 1824 KB Output is correct
97 Correct 2 ms 1664 KB Output is correct
98 Correct 2 ms 1792 KB Output is correct
99 Correct 2 ms 1408 KB Output is correct
100 Correct 2 ms 1152 KB Output is correct
101 Correct 2 ms 1792 KB Output is correct
102 Correct 6 ms 7168 KB Output is correct
103 Correct 6 ms 7424 KB Output is correct
104 Correct 13 ms 10368 KB Output is correct
105 Correct 7 ms 7936 KB Output is correct
106 Correct 6 ms 6400 KB Output is correct
107 Correct 8 ms 9088 KB Output is correct
108 Correct 5 ms 6272 KB Output is correct
109 Correct 8 ms 8320 KB Output is correct
110 Correct 12 ms 10112 KB Output is correct
111 Correct 2 ms 1920 KB Output is correct
112 Correct 1 ms 256 KB Output is correct
113 Correct 2 ms 1536 KB Output is correct
114 Correct 1 ms 1280 KB Output is correct
115 Correct 1 ms 928 KB Output is correct
116 Correct 2 ms 1920 KB Output is correct
117 Correct 2 ms 1536 KB Output is correct
118 Correct 2 ms 1664 KB Output is correct
119 Correct 3 ms 1408 KB Output is correct
120 Correct 107 ms 9548 KB Output is correct
121 Correct 1943 ms 149240 KB Output is correct
122 Correct 1696 ms 156920 KB Output is correct
123 Correct 1121 ms 139768 KB Output is correct
124 Correct 1239 ms 155128 KB Output is correct
125 Correct 1761 ms 151416 KB Output is correct
126 Execution timed out 2044 ms 173176 KB Time limit exceeded
127 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 753 ms 182392 KB Output is correct
2 Correct 1200 ms 283604 KB Output is correct
3 Correct 261 ms 74872 KB Output is correct
4 Correct 416 ms 111480 KB Output is correct
5 Execution timed out 2144 ms 750260 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1585 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1542 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1792 KB Output is correct
2 Correct 6 ms 7168 KB Output is correct
3 Correct 9 ms 7424 KB Output is correct
4 Correct 18 ms 10368 KB Output is correct
5 Correct 11 ms 7936 KB Output is correct
6 Correct 6 ms 6400 KB Output is correct
7 Correct 14 ms 9088 KB Output is correct
8 Correct 6 ms 6272 KB Output is correct
9 Correct 8 ms 8320 KB Output is correct
10 Correct 14 ms 10112 KB Output is correct
11 Correct 2 ms 1152 KB Output is correct
12 Correct 2 ms 1792 KB Output is correct
13 Correct 6 ms 7168 KB Output is correct
14 Correct 7 ms 7424 KB Output is correct
15 Correct 15 ms 10368 KB Output is correct
16 Correct 7 ms 7936 KB Output is correct
17 Correct 6 ms 6400 KB Output is correct
18 Correct 8 ms 9088 KB Output is correct
19 Correct 5 ms 6272 KB Output is correct
20 Correct 8 ms 8320 KB Output is correct
21 Correct 2 ms 1920 KB Output is correct
22 Correct 14 ms 10112 KB Output is correct
23 Correct 2 ms 1920 KB Output is correct
24 Correct 1 ms 256 KB Output is correct
25 Correct 2 ms 1536 KB Output is correct
26 Correct 1 ms 1280 KB Output is correct
27 Correct 1 ms 896 KB Output is correct
28 Correct 3 ms 1920 KB Output is correct
29 Correct 2 ms 1536 KB Output is correct
30 Correct 2 ms 1792 KB Output is correct
31 Correct 4 ms 1408 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 2 ms 1536 KB Output is correct
34 Correct 1 ms 1280 KB Output is correct
35 Correct 2 ms 1024 KB Output is correct
36 Correct 3 ms 1920 KB Output is correct
37 Correct 2 ms 1664 KB Output is correct
38 Correct 2 ms 1664 KB Output is correct
39 Correct 2 ms 1408 KB Output is correct
40 Correct 2 ms 1152 KB Output is correct
41 Correct 3 ms 1792 KB Output is correct
42 Correct 6 ms 7168 KB Output is correct
43 Correct 6 ms 7424 KB Output is correct
44 Correct 13 ms 10368 KB Output is correct
45 Correct 10 ms 7936 KB Output is correct
46 Correct 6 ms 6400 KB Output is correct
47 Correct 12 ms 9088 KB Output is correct
48 Correct 5 ms 6272 KB Output is correct
49 Correct 8 ms 8320 KB Output is correct
50 Correct 12 ms 10112 KB Output is correct
51 Correct 2 ms 1920 KB Output is correct
52 Correct 0 ms 256 KB Output is correct
53 Correct 2 ms 1536 KB Output is correct
54 Correct 1 ms 1280 KB Output is correct
55 Correct 1 ms 896 KB Output is correct
56 Correct 2 ms 1920 KB Output is correct
57 Correct 2 ms 1664 KB Output is correct
58 Correct 2 ms 1664 KB Output is correct
59 Correct 3 ms 1408 KB Output is correct
60 Correct 1 ms 1152 KB Output is correct
61 Correct 3 ms 1792 KB Output is correct
62 Correct 6 ms 7168 KB Output is correct
63 Correct 6 ms 7424 KB Output is correct
64 Correct 13 ms 10368 KB Output is correct
65 Correct 7 ms 7936 KB Output is correct
66 Correct 6 ms 6400 KB Output is correct
67 Correct 8 ms 9088 KB Output is correct
68 Correct 5 ms 6272 KB Output is correct
69 Correct 8 ms 8320 KB Output is correct
70 Correct 13 ms 10112 KB Output is correct
71 Correct 2 ms 1920 KB Output is correct
72 Correct 0 ms 256 KB Output is correct
73 Correct 2 ms 1536 KB Output is correct
74 Correct 1 ms 1280 KB Output is correct
75 Correct 1 ms 896 KB Output is correct
76 Correct 2 ms 1920 KB Output is correct
77 Correct 3 ms 1664 KB Output is correct
78 Correct 2 ms 1664 KB Output is correct
79 Correct 3 ms 1408 KB Output is correct
80 Correct 2 ms 1152 KB Output is correct
81 Correct 2 ms 1792 KB Output is correct
82 Correct 6 ms 7168 KB Output is correct
83 Correct 7 ms 7424 KB Output is correct
84 Correct 13 ms 10368 KB Output is correct
85 Correct 7 ms 7936 KB Output is correct
86 Correct 5 ms 6400 KB Output is correct
87 Correct 8 ms 9088 KB Output is correct
88 Correct 6 ms 6272 KB Output is correct
89 Correct 8 ms 8320 KB Output is correct
90 Correct 12 ms 10112 KB Output is correct
91 Correct 2 ms 1920 KB Output is correct
92 Correct 0 ms 256 KB Output is correct
93 Correct 2 ms 1536 KB Output is correct
94 Correct 1 ms 1280 KB Output is correct
95 Correct 1 ms 896 KB Output is correct
96 Correct 2 ms 1824 KB Output is correct
97 Correct 2 ms 1664 KB Output is correct
98 Correct 2 ms 1792 KB Output is correct
99 Correct 2 ms 1408 KB Output is correct
100 Correct 2 ms 1152 KB Output is correct
101 Correct 2 ms 1792 KB Output is correct
102 Correct 6 ms 7168 KB Output is correct
103 Correct 6 ms 7424 KB Output is correct
104 Correct 13 ms 10368 KB Output is correct
105 Correct 7 ms 7936 KB Output is correct
106 Correct 6 ms 6400 KB Output is correct
107 Correct 8 ms 9088 KB Output is correct
108 Correct 5 ms 6272 KB Output is correct
109 Correct 8 ms 8320 KB Output is correct
110 Correct 12 ms 10112 KB Output is correct
111 Correct 2 ms 1920 KB Output is correct
112 Correct 1 ms 256 KB Output is correct
113 Correct 2 ms 1536 KB Output is correct
114 Correct 1 ms 1280 KB Output is correct
115 Correct 1 ms 928 KB Output is correct
116 Correct 2 ms 1920 KB Output is correct
117 Correct 2 ms 1536 KB Output is correct
118 Correct 2 ms 1664 KB Output is correct
119 Correct 3 ms 1408 KB Output is correct
120 Correct 107 ms 9548 KB Output is correct
121 Correct 1943 ms 149240 KB Output is correct
122 Correct 1696 ms 156920 KB Output is correct
123 Correct 1121 ms 139768 KB Output is correct
124 Correct 1239 ms 155128 KB Output is correct
125 Correct 1761 ms 151416 KB Output is correct
126 Execution timed out 2044 ms 173176 KB Time limit exceeded
127 Halted 0 ms 0 KB -