#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << x << endl;
#define task ""
using namespace std;
int fdp[2001][10001], bdp[2001][10001], ans;
pair<int, int> c[2001];
int n;
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
{
n = a.size();
for (int i=0; i<n; i++) c[i] = make_pair(a[i], b[i]);
sort(c, c+n);
for (int i=1; i<=n; i++)
{
for (int j=0; j<=x; j++)
{
fdp[i][j] = fdp[i-1][j]+c[i-1].second;
if(j >= c[i-1].first)
{
fdp[i][j] = min(fdp[i][j], fdp[i-1][j-c[i-1].first]);
}
}
}
for(int i=n-1; i>=0; i--)
{
for (int j=0; j<y; j++)
{
bdp[i][j] = bdp[i+1][j];
if(j >= c[i].second)
{
bdp[i][j] = max(bdp[i][j], bdp[i+1][j-c[i].second]+1);
}
}
}
for (int i=0; i<=n; i++)
{
int yleft = y-fdp[i][x];
if(yleft >= 0) ans = max(ans, i+bdp[i][yleft]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '5', found: '4' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '5', found: '4' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
21240 KB |
1st lines differ - on the 1st token, expected: '689', found: '65' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
94328 KB |
Output is correct |
2 |
Correct |
135 ms |
155640 KB |
Output is correct |
3 |
Correct |
135 ms |
156280 KB |
Output is correct |
4 |
Correct |
133 ms |
149624 KB |
Output is correct |
5 |
Correct |
137 ms |
155128 KB |
Output is correct |
6 |
Correct |
129 ms |
149368 KB |
Output is correct |
7 |
Correct |
129 ms |
154232 KB |
Output is correct |
8 |
Correct |
124 ms |
150152 KB |
Output is correct |
9 |
Correct |
133 ms |
150136 KB |
Output is correct |
10 |
Correct |
140 ms |
152184 KB |
Output is correct |
11 |
Correct |
70 ms |
88824 KB |
Output is correct |
12 |
Correct |
5 ms |
8064 KB |
Output is correct |
13 |
Correct |
69 ms |
86520 KB |
Output is correct |
14 |
Correct |
73 ms |
85756 KB |
Output is correct |
15 |
Correct |
74 ms |
88568 KB |
Output is correct |
16 |
Correct |
66 ms |
84216 KB |
Output is correct |
17 |
Correct |
71 ms |
87160 KB |
Output is correct |
18 |
Correct |
79 ms |
94328 KB |
Output is correct |
19 |
Correct |
78 ms |
90744 KB |
Output is correct |
20 |
Correct |
71 ms |
86136 KB |
Output is correct |
21 |
Correct |
78 ms |
94328 KB |
Output is correct |
22 |
Correct |
129 ms |
155640 KB |
Output is correct |
23 |
Correct |
134 ms |
156280 KB |
Output is correct |
24 |
Correct |
134 ms |
149584 KB |
Output is correct |
25 |
Correct |
141 ms |
155128 KB |
Output is correct |
26 |
Correct |
134 ms |
149452 KB |
Output is correct |
27 |
Correct |
130 ms |
154232 KB |
Output is correct |
28 |
Correct |
126 ms |
150136 KB |
Output is correct |
29 |
Correct |
133 ms |
150008 KB |
Output is correct |
30 |
Correct |
135 ms |
152148 KB |
Output is correct |
31 |
Correct |
71 ms |
88824 KB |
Output is correct |
32 |
Correct |
5 ms |
8064 KB |
Output is correct |
33 |
Correct |
77 ms |
86520 KB |
Output is correct |
34 |
Correct |
74 ms |
85752 KB |
Output is correct |
35 |
Correct |
84 ms |
88568 KB |
Output is correct |
36 |
Correct |
68 ms |
84216 KB |
Output is correct |
37 |
Correct |
74 ms |
87160 KB |
Output is correct |
38 |
Correct |
83 ms |
94328 KB |
Output is correct |
39 |
Correct |
170 ms |
90872 KB |
Output is correct |
40 |
Correct |
87 ms |
86140 KB |
Output is correct |
41 |
Correct |
84 ms |
94328 KB |
Output is correct |
42 |
Correct |
135 ms |
155640 KB |
Output is correct |
43 |
Correct |
129 ms |
156268 KB |
Output is correct |
44 |
Correct |
150 ms |
149672 KB |
Output is correct |
45 |
Correct |
155 ms |
155128 KB |
Output is correct |
46 |
Correct |
132 ms |
149384 KB |
Output is correct |
47 |
Correct |
136 ms |
154140 KB |
Output is correct |
48 |
Correct |
138 ms |
150136 KB |
Output is correct |
49 |
Correct |
143 ms |
150008 KB |
Output is correct |
50 |
Correct |
136 ms |
152184 KB |
Output is correct |
51 |
Correct |
77 ms |
88952 KB |
Output is correct |
52 |
Correct |
5 ms |
8064 KB |
Output is correct |
53 |
Correct |
68 ms |
86520 KB |
Output is correct |
54 |
Correct |
72 ms |
85640 KB |
Output is correct |
55 |
Correct |
74 ms |
88440 KB |
Output is correct |
56 |
Correct |
67 ms |
84216 KB |
Output is correct |
57 |
Correct |
72 ms |
87192 KB |
Output is correct |
58 |
Correct |
80 ms |
94456 KB |
Output is correct |
59 |
Correct |
81 ms |
90744 KB |
Output is correct |
60 |
Correct |
72 ms |
86136 KB |
Output is correct |
61 |
Correct |
78 ms |
94328 KB |
Output is correct |
62 |
Correct |
131 ms |
155640 KB |
Output is correct |
63 |
Correct |
129 ms |
156280 KB |
Output is correct |
64 |
Correct |
135 ms |
149624 KB |
Output is correct |
65 |
Correct |
136 ms |
155128 KB |
Output is correct |
66 |
Correct |
130 ms |
149392 KB |
Output is correct |
67 |
Correct |
132 ms |
154232 KB |
Output is correct |
68 |
Correct |
126 ms |
150136 KB |
Output is correct |
69 |
Correct |
130 ms |
150012 KB |
Output is correct |
70 |
Correct |
133 ms |
152184 KB |
Output is correct |
71 |
Correct |
71 ms |
88824 KB |
Output is correct |
72 |
Correct |
5 ms |
8064 KB |
Output is correct |
73 |
Correct |
69 ms |
86520 KB |
Output is correct |
74 |
Correct |
73 ms |
85624 KB |
Output is correct |
75 |
Correct |
74 ms |
88440 KB |
Output is correct |
76 |
Correct |
66 ms |
84216 KB |
Output is correct |
77 |
Correct |
73 ms |
87160 KB |
Output is correct |
78 |
Correct |
80 ms |
94328 KB |
Output is correct |
79 |
Correct |
77 ms |
90744 KB |
Output is correct |
80 |
Correct |
71 ms |
86136 KB |
Output is correct |
81 |
Correct |
78 ms |
94356 KB |
Output is correct |
82 |
Correct |
131 ms |
155640 KB |
Output is correct |
83 |
Correct |
131 ms |
156280 KB |
Output is correct |
84 |
Correct |
133 ms |
149624 KB |
Output is correct |
85 |
Correct |
136 ms |
155152 KB |
Output is correct |
86 |
Correct |
130 ms |
149400 KB |
Output is correct |
87 |
Correct |
130 ms |
154232 KB |
Output is correct |
88 |
Correct |
125 ms |
150136 KB |
Output is correct |
89 |
Correct |
131 ms |
150084 KB |
Output is correct |
90 |
Correct |
135 ms |
152184 KB |
Output is correct |
91 |
Correct |
71 ms |
88952 KB |
Output is correct |
92 |
Correct |
5 ms |
8064 KB |
Output is correct |
93 |
Correct |
69 ms |
86520 KB |
Output is correct |
94 |
Correct |
72 ms |
85624 KB |
Output is correct |
95 |
Correct |
76 ms |
88440 KB |
Output is correct |
96 |
Correct |
66 ms |
84216 KB |
Output is correct |
97 |
Correct |
72 ms |
87160 KB |
Output is correct |
98 |
Correct |
80 ms |
94328 KB |
Output is correct |
99 |
Correct |
77 ms |
90744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
93304 KB |
Output is correct |
2 |
Correct |
127 ms |
150056 KB |
Output is correct |
3 |
Correct |
128 ms |
154232 KB |
Output is correct |
4 |
Correct |
135 ms |
153464 KB |
Output is correct |
5 |
Correct |
136 ms |
149240 KB |
Output is correct |
6 |
Correct |
130 ms |
153736 KB |
Output is correct |
7 |
Correct |
131 ms |
155640 KB |
Output is correct |
8 |
Correct |
131 ms |
149796 KB |
Output is correct |
9 |
Correct |
138 ms |
154232 KB |
Output is correct |
10 |
Correct |
139 ms |
156280 KB |
Output is correct |
11 |
Correct |
73 ms |
86136 KB |
Output is correct |
12 |
Correct |
5 ms |
8320 KB |
Output is correct |
13 |
Correct |
83 ms |
97144 KB |
Output is correct |
14 |
Correct |
75 ms |
88952 KB |
Output is correct |
15 |
Correct |
83 ms |
98040 KB |
Output is correct |
16 |
Correct |
76 ms |
93432 KB |
Output is correct |
17 |
Correct |
85 ms |
100856 KB |
Output is correct |
18 |
Correct |
84 ms |
100856 KB |
Output is correct |
19 |
Correct |
72 ms |
86264 KB |
Output is correct |
20 |
Correct |
72 ms |
86776 KB |
Output is correct |
21 |
Correct |
76 ms |
93324 KB |
Output is correct |
22 |
Correct |
129 ms |
150008 KB |
Output is correct |
23 |
Correct |
128 ms |
154232 KB |
Output is correct |
24 |
Correct |
139 ms |
153592 KB |
Output is correct |
25 |
Correct |
131 ms |
149240 KB |
Output is correct |
26 |
Correct |
130 ms |
153848 KB |
Output is correct |
27 |
Correct |
133 ms |
155692 KB |
Output is correct |
28 |
Correct |
126 ms |
149832 KB |
Output is correct |
29 |
Correct |
132 ms |
154156 KB |
Output is correct |
30 |
Correct |
138 ms |
156280 KB |
Output is correct |
31 |
Correct |
72 ms |
86060 KB |
Output is correct |
32 |
Correct |
5 ms |
8320 KB |
Output is correct |
33 |
Correct |
84 ms |
97192 KB |
Output is correct |
34 |
Correct |
75 ms |
88952 KB |
Output is correct |
35 |
Correct |
83 ms |
98040 KB |
Output is correct |
36 |
Correct |
79 ms |
93304 KB |
Output is correct |
37 |
Correct |
84 ms |
100880 KB |
Output is correct |
38 |
Correct |
82 ms |
100856 KB |
Output is correct |
39 |
Correct |
72 ms |
86264 KB |
Output is correct |
40 |
Correct |
73 ms |
86652 KB |
Output is correct |
41 |
Correct |
77 ms |
93304 KB |
Output is correct |
42 |
Correct |
127 ms |
150008 KB |
Output is correct |
43 |
Correct |
132 ms |
154224 KB |
Output is correct |
44 |
Correct |
134 ms |
153496 KB |
Output is correct |
45 |
Correct |
130 ms |
149240 KB |
Output is correct |
46 |
Correct |
132 ms |
153848 KB |
Output is correct |
47 |
Correct |
131 ms |
155732 KB |
Output is correct |
48 |
Correct |
127 ms |
149752 KB |
Output is correct |
49 |
Correct |
137 ms |
154272 KB |
Output is correct |
50 |
Correct |
140 ms |
156280 KB |
Output is correct |
51 |
Correct |
75 ms |
86008 KB |
Output is correct |
52 |
Correct |
5 ms |
8320 KB |
Output is correct |
53 |
Correct |
81 ms |
97144 KB |
Output is correct |
54 |
Correct |
78 ms |
88952 KB |
Output is correct |
55 |
Correct |
82 ms |
98040 KB |
Output is correct |
56 |
Correct |
82 ms |
93304 KB |
Output is correct |
57 |
Correct |
82 ms |
100896 KB |
Output is correct |
58 |
Correct |
82 ms |
100856 KB |
Output is correct |
59 |
Correct |
75 ms |
86264 KB |
Output is correct |
60 |
Correct |
73 ms |
86776 KB |
Output is correct |
61 |
Correct |
80 ms |
93304 KB |
Output is correct |
62 |
Correct |
126 ms |
150008 KB |
Output is correct |
63 |
Correct |
128 ms |
154232 KB |
Output is correct |
64 |
Correct |
140 ms |
153464 KB |
Output is correct |
65 |
Correct |
130 ms |
149240 KB |
Output is correct |
66 |
Correct |
129 ms |
153848 KB |
Output is correct |
67 |
Correct |
138 ms |
155688 KB |
Output is correct |
68 |
Correct |
129 ms |
149752 KB |
Output is correct |
69 |
Correct |
132 ms |
154136 KB |
Output is correct |
70 |
Correct |
140 ms |
156280 KB |
Output is correct |
71 |
Correct |
75 ms |
86008 KB |
Output is correct |
72 |
Correct |
5 ms |
8320 KB |
Output is correct |
73 |
Correct |
83 ms |
97144 KB |
Output is correct |
74 |
Correct |
76 ms |
88892 KB |
Output is correct |
75 |
Correct |
86 ms |
98040 KB |
Output is correct |
76 |
Correct |
81 ms |
93304 KB |
Output is correct |
77 |
Correct |
86 ms |
100856 KB |
Output is correct |
78 |
Correct |
84 ms |
100856 KB |
Output is correct |
79 |
Correct |
74 ms |
86264 KB |
Output is correct |
80 |
Correct |
76 ms |
86776 KB |
Output is correct |
81 |
Correct |
78 ms |
93220 KB |
Output is correct |
82 |
Correct |
129 ms |
150008 KB |
Output is correct |
83 |
Correct |
127 ms |
154232 KB |
Output is correct |
84 |
Correct |
134 ms |
153464 KB |
Output is correct |
85 |
Correct |
130 ms |
149240 KB |
Output is correct |
86 |
Correct |
130 ms |
153848 KB |
Output is correct |
87 |
Correct |
130 ms |
155640 KB |
Output is correct |
88 |
Correct |
134 ms |
149880 KB |
Output is correct |
89 |
Correct |
132 ms |
154232 KB |
Output is correct |
90 |
Correct |
137 ms |
156408 KB |
Output is correct |
91 |
Correct |
72 ms |
86008 KB |
Output is correct |
92 |
Correct |
5 ms |
8320 KB |
Output is correct |
93 |
Correct |
82 ms |
97200 KB |
Output is correct |
94 |
Correct |
75 ms |
88952 KB |
Output is correct |
95 |
Correct |
84 ms |
98040 KB |
Output is correct |
96 |
Correct |
78 ms |
93304 KB |
Output is correct |
97 |
Correct |
85 ms |
100856 KB |
Output is correct |
98 |
Correct |
84 ms |
100984 KB |
Output is correct |
99 |
Correct |
72 ms |
86264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Incorrect |
1 ms |
384 KB |
1st lines differ - on the 1st token, expected: '5', found: '4' |
9 |
Halted |
0 ms |
0 KB |
- |