#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
const int MAXM = 1e4 + 10;
int dp[MAXN][MAXM];
int calc(int i, int x, int y, int N, vector<int> &a, vector<int> &b)
{
if(x < 0 || y < 0) return -1;
if(dp[i][x] != 0) return dp[i][x];
if(i > N) return 0;
int op1 = calc(i + 1, x - a[i - 1], y, N, a, b) + 1;
int op2 = calc(i + 1, x, y - b[i - 1], N , a, b) + 1;
dp[i][x] = max(op1,op2);
return dp[i][x];
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int N = a.size();
sort(a.begin(),a.end());
sort(b.begin(),b.end());
return calc(1,x,y,N,a,b);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
7004 KB |
1st lines differ - on the 1st token, expected: '689', found: '645' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
127 ms |
45904 KB |
Output is correct |
5 |
Correct |
122 ms |
44632 KB |
Output is correct |
6 |
Correct |
1 ms |
856 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
113 ms |
44096 KB |
Output is correct |
10 |
Correct |
122 ms |
44652 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
600 KB |
Output is correct |
14 |
Correct |
11 ms |
9820 KB |
Output is correct |
15 |
Correct |
7 ms |
7004 KB |
Output is correct |
16 |
Correct |
1 ms |
856 KB |
Output is correct |
17 |
Correct |
2 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
31 ms |
17688 KB |
Output is correct |
20 |
Correct |
9 ms |
9052 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
132 ms |
45892 KB |
Output is correct |
25 |
Correct |
118 ms |
44628 KB |
Output is correct |
26 |
Correct |
1 ms |
860 KB |
Output is correct |
27 |
Correct |
1 ms |
604 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
109 ms |
44112 KB |
Output is correct |
30 |
Correct |
117 ms |
44640 KB |
Output is correct |
31 |
Correct |
1 ms |
600 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
604 KB |
Output is correct |
34 |
Correct |
11 ms |
9780 KB |
Output is correct |
35 |
Correct |
7 ms |
7000 KB |
Output is correct |
36 |
Correct |
1 ms |
868 KB |
Output is correct |
37 |
Correct |
2 ms |
876 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
30 ms |
17640 KB |
Output is correct |
40 |
Correct |
10 ms |
9052 KB |
Output is correct |
41 |
Correct |
1 ms |
600 KB |
Output is correct |
42 |
Correct |
1 ms |
856 KB |
Output is correct |
43 |
Correct |
1 ms |
604 KB |
Output is correct |
44 |
Correct |
142 ms |
45932 KB |
Output is correct |
45 |
Correct |
115 ms |
44652 KB |
Output is correct |
46 |
Correct |
1 ms |
860 KB |
Output is correct |
47 |
Correct |
1 ms |
600 KB |
Output is correct |
48 |
Correct |
1 ms |
600 KB |
Output is correct |
49 |
Correct |
129 ms |
44116 KB |
Output is correct |
50 |
Correct |
124 ms |
44880 KB |
Output is correct |
51 |
Correct |
1 ms |
604 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
1 ms |
604 KB |
Output is correct |
54 |
Correct |
11 ms |
9768 KB |
Output is correct |
55 |
Correct |
10 ms |
7004 KB |
Output is correct |
56 |
Correct |
1 ms |
604 KB |
Output is correct |
57 |
Correct |
2 ms |
860 KB |
Output is correct |
58 |
Correct |
1 ms |
604 KB |
Output is correct |
59 |
Correct |
31 ms |
17656 KB |
Output is correct |
60 |
Correct |
10 ms |
9048 KB |
Output is correct |
61 |
Correct |
1 ms |
604 KB |
Output is correct |
62 |
Correct |
1 ms |
600 KB |
Output is correct |
63 |
Correct |
1 ms |
604 KB |
Output is correct |
64 |
Correct |
125 ms |
46012 KB |
Output is correct |
65 |
Correct |
126 ms |
44624 KB |
Output is correct |
66 |
Correct |
1 ms |
860 KB |
Output is correct |
67 |
Correct |
1 ms |
604 KB |
Output is correct |
68 |
Correct |
1 ms |
600 KB |
Output is correct |
69 |
Correct |
108 ms |
44112 KB |
Output is correct |
70 |
Correct |
117 ms |
44884 KB |
Output is correct |
71 |
Correct |
1 ms |
604 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
1 ms |
600 KB |
Output is correct |
74 |
Correct |
10 ms |
9688 KB |
Output is correct |
75 |
Correct |
7 ms |
7036 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
2 ms |
860 KB |
Output is correct |
78 |
Correct |
1 ms |
604 KB |
Output is correct |
79 |
Correct |
31 ms |
17784 KB |
Output is correct |
80 |
Correct |
10 ms |
9052 KB |
Output is correct |
81 |
Correct |
2 ms |
604 KB |
Output is correct |
82 |
Correct |
1 ms |
600 KB |
Output is correct |
83 |
Correct |
1 ms |
604 KB |
Output is correct |
84 |
Correct |
129 ms |
46032 KB |
Output is correct |
85 |
Correct |
132 ms |
44628 KB |
Output is correct |
86 |
Correct |
2 ms |
860 KB |
Output is correct |
87 |
Correct |
1 ms |
604 KB |
Output is correct |
88 |
Correct |
1 ms |
604 KB |
Output is correct |
89 |
Correct |
106 ms |
43880 KB |
Output is correct |
90 |
Correct |
121 ms |
44880 KB |
Output is correct |
91 |
Correct |
1 ms |
604 KB |
Output is correct |
92 |
Correct |
1 ms |
348 KB |
Output is correct |
93 |
Correct |
1 ms |
604 KB |
Output is correct |
94 |
Correct |
10 ms |
9816 KB |
Output is correct |
95 |
Correct |
7 ms |
6928 KB |
Output is correct |
96 |
Correct |
1 ms |
600 KB |
Output is correct |
97 |
Correct |
1 ms |
856 KB |
Output is correct |
98 |
Correct |
1 ms |
604 KB |
Output is correct |
99 |
Correct |
31 ms |
17712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1628 KB |
Output is correct |
2 |
Correct |
5 ms |
2392 KB |
Output is correct |
3 |
Correct |
4 ms |
1884 KB |
Output is correct |
4 |
Correct |
85 ms |
38736 KB |
Output is correct |
5 |
Correct |
81 ms |
36276 KB |
Output is correct |
6 |
Correct |
5 ms |
2136 KB |
Output is correct |
7 |
Correct |
5 ms |
1880 KB |
Output is correct |
8 |
Correct |
5 ms |
2140 KB |
Output is correct |
9 |
Correct |
91 ms |
38060 KB |
Output is correct |
10 |
Correct |
130 ms |
40152 KB |
Output is correct |
11 |
Correct |
2 ms |
1624 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
3 ms |
1476 KB |
Output is correct |
14 |
Correct |
17 ms |
11352 KB |
Output is correct |
15 |
Correct |
47 ms |
18436 KB |
Output is correct |
16 |
Correct |
2 ms |
1624 KB |
Output is correct |
17 |
Correct |
3 ms |
1368 KB |
Output is correct |
18 |
Correct |
3 ms |
1624 KB |
Output is correct |
19 |
Correct |
6 ms |
8904 KB |
Output is correct |
20 |
Correct |
5 ms |
8792 KB |
Output is correct |
21 |
Correct |
2 ms |
1628 KB |
Output is correct |
22 |
Correct |
5 ms |
2140 KB |
Output is correct |
23 |
Correct |
4 ms |
1884 KB |
Output is correct |
24 |
Correct |
92 ms |
38740 KB |
Output is correct |
25 |
Correct |
81 ms |
36236 KB |
Output is correct |
26 |
Correct |
5 ms |
2248 KB |
Output is correct |
27 |
Correct |
6 ms |
1884 KB |
Output is correct |
28 |
Correct |
5 ms |
2112 KB |
Output is correct |
29 |
Correct |
83 ms |
37968 KB |
Output is correct |
30 |
Correct |
90 ms |
40288 KB |
Output is correct |
31 |
Correct |
2 ms |
1624 KB |
Output is correct |
32 |
Correct |
1 ms |
448 KB |
Output is correct |
33 |
Correct |
3 ms |
1372 KB |
Output is correct |
34 |
Correct |
23 ms |
11372 KB |
Output is correct |
35 |
Correct |
41 ms |
18472 KB |
Output is correct |
36 |
Correct |
2 ms |
1368 KB |
Output is correct |
37 |
Correct |
3 ms |
1372 KB |
Output is correct |
38 |
Correct |
3 ms |
1368 KB |
Output is correct |
39 |
Correct |
6 ms |
8756 KB |
Output is correct |
40 |
Correct |
5 ms |
8792 KB |
Output is correct |
41 |
Correct |
2 ms |
1628 KB |
Output is correct |
42 |
Correct |
5 ms |
2140 KB |
Output is correct |
43 |
Correct |
5 ms |
1880 KB |
Output is correct |
44 |
Correct |
96 ms |
39028 KB |
Output is correct |
45 |
Correct |
79 ms |
36432 KB |
Output is correct |
46 |
Correct |
5 ms |
2136 KB |
Output is correct |
47 |
Correct |
5 ms |
1880 KB |
Output is correct |
48 |
Correct |
6 ms |
2140 KB |
Output is correct |
49 |
Correct |
87 ms |
37972 KB |
Output is correct |
50 |
Correct |
106 ms |
40640 KB |
Output is correct |
51 |
Correct |
2 ms |
1628 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
3 ms |
1368 KB |
Output is correct |
54 |
Correct |
19 ms |
11532 KB |
Output is correct |
55 |
Correct |
39 ms |
18324 KB |
Output is correct |
56 |
Correct |
2 ms |
1372 KB |
Output is correct |
57 |
Correct |
3 ms |
1372 KB |
Output is correct |
58 |
Correct |
2 ms |
1392 KB |
Output is correct |
59 |
Correct |
5 ms |
8792 KB |
Output is correct |
60 |
Correct |
5 ms |
8796 KB |
Output is correct |
61 |
Correct |
2 ms |
1628 KB |
Output is correct |
62 |
Correct |
5 ms |
2140 KB |
Output is correct |
63 |
Correct |
5 ms |
1884 KB |
Output is correct |
64 |
Correct |
92 ms |
38572 KB |
Output is correct |
65 |
Correct |
79 ms |
36252 KB |
Output is correct |
66 |
Correct |
5 ms |
2140 KB |
Output is correct |
67 |
Correct |
5 ms |
1880 KB |
Output is correct |
68 |
Correct |
5 ms |
2136 KB |
Output is correct |
69 |
Correct |
88 ms |
38008 KB |
Output is correct |
70 |
Correct |
94 ms |
40252 KB |
Output is correct |
71 |
Correct |
3 ms |
1624 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
3 ms |
1372 KB |
Output is correct |
74 |
Correct |
20 ms |
11356 KB |
Output is correct |
75 |
Correct |
37 ms |
18328 KB |
Output is correct |
76 |
Correct |
3 ms |
1372 KB |
Output is correct |
77 |
Correct |
3 ms |
1372 KB |
Output is correct |
78 |
Correct |
3 ms |
1372 KB |
Output is correct |
79 |
Correct |
6 ms |
8728 KB |
Output is correct |
80 |
Correct |
5 ms |
8796 KB |
Output is correct |
81 |
Correct |
2 ms |
1628 KB |
Output is correct |
82 |
Correct |
7 ms |
2268 KB |
Output is correct |
83 |
Correct |
5 ms |
1884 KB |
Output is correct |
84 |
Correct |
89 ms |
38592 KB |
Output is correct |
85 |
Correct |
83 ms |
36264 KB |
Output is correct |
86 |
Correct |
5 ms |
2136 KB |
Output is correct |
87 |
Correct |
5 ms |
1884 KB |
Output is correct |
88 |
Correct |
8 ms |
2140 KB |
Output is correct |
89 |
Correct |
103 ms |
38044 KB |
Output is correct |
90 |
Correct |
92 ms |
40280 KB |
Output is correct |
91 |
Correct |
2 ms |
1628 KB |
Output is correct |
92 |
Correct |
1 ms |
348 KB |
Output is correct |
93 |
Correct |
3 ms |
1508 KB |
Output is correct |
94 |
Correct |
18 ms |
11356 KB |
Output is correct |
95 |
Correct |
41 ms |
18260 KB |
Output is correct |
96 |
Correct |
2 ms |
1372 KB |
Output is correct |
97 |
Correct |
3 ms |
1504 KB |
Output is correct |
98 |
Correct |
3 ms |
1372 KB |
Output is correct |
99 |
Correct |
6 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |