Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given a matrix a of size n x m consisting of integers. You can choose no more than <= ft lfloor frac{m}{2} right rfloor elements in each row. Your task is to choose these elements in such a way that their sum is divisible by k and this sum is the maximum. In other words, you can choose no more than a half (rounded down) of elements in each row, you have to find the maximum sum of these elements divisible by k . Note that you can choose zero elements (and the sum of such set is 0 ). The first line of the input contains three integers n , m and k ( 1 <= n, m, k <= 70 ) -- the number of rows in the matrix, the number of columns in the matrix and the value of k . The next n lines contain m elements each, where the j -th element of the i -th row is a_{i, j} ( 1 <= a_{i, j} <= 70 ). Print one integer -- the maximum sum divisible by k you can obtain. In the first example, the optimal answer is 2 and 4 in the first row, 5 and 2 in the second row and 7 and 4 in the third row. The total sum is 2 + 4 + 5 + 2 + 7 + 4 = 24 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
96185847 |
Gassa |
F |
Oct. 20, 2020, 8:18 p.m. |
OK |
D |
TESTS |
235 |
109 |
1945600 |
|
|
96163957 |
daut-dlang |
F |
Oct. 20, 2020, 4:32 p.m. |
OK |
D |
TESTS |
32 |
186 |
1945600 |
|
|
96174855 |
ruban |
F |
Oct. 20, 2020, 5:47 p.m. |
OK |
Delphi |
TESTS |
32 |
218 |
115097600 |
|
|
96199689 |
fishcathu. |
F |
Oct. 21, 2020, 3:29 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
46 |
0 |
|
|
96198585 |
fishcathu. |
F |
Oct. 21, 2020, 3:03 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
46 |
0 |
|
|
96162119 |
Black.n.White |
F |
Oct. 20, 2020, 4:28 p.m. |
OK |
GNU C++11 |
TESTS |
32 |
46 |
0 |
|
|
96169608 |
HHHEN |
F |
Oct. 20, 2020, 5:01 p.m. |
OK |
GNU C++11 |
TESTS |
32 |
46 |
102400 |
|
|
96179779 |
angelskid |
F |
Oct. 20, 2020, 6:45 p.m. |
OK |
GNU C++11 |
TESTS |
235 |
46 |
716800 |
|
|
96162508 |
czswez |
F |
Oct. 20, 2020, 4:29 p.m. |
OK |
GNU C++11 |
TESTS |
32 |
46 |
1433600 |
|
|
96205557 |
kidoil |
F |
Oct. 21, 2020, 5:28 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
46 |
2150400 |
|
|
96194027 |
wannaAC |
F |
Oct. 21, 2020, 12:48 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
46 |
6656000 |
|
|
96203609 |
fishcathu. |
F |
Oct. 21, 2020, 4:56 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
61 |
0 |
|
|
96203494 |
fishcathu. |
F |
Oct. 21, 2020, 4:54 a.m. |
OK |
GNU C++11 |
TESTS |
254 |
61 |
0 |
|
|
96195555 |
youarethestupiddog |
F |
Oct. 21, 2020, 1:42 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
46 |
0 |
|
|
96207273 |
StelaYuri |
F |
Oct. 21, 2020, 5:56 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
46 |
102400 |
|
|
96196471 |
4790iop |
F |
Oct. 21, 2020, 2:12 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
46 |
102400 |
|
|
96181302 |
bastard123 |
F |
Oct. 20, 2020, 7:05 p.m. |
OK |
GNU C++14 |
TESTS |
235 |
46 |
2764800 |
|
|
96207283 |
Mihai145 |
F |
Oct. 21, 2020, 5:56 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
61 |
102400 |
|
|
96163345 |
SemonChan |
F |
Oct. 20, 2020, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
32 |
61 |
204800 |
|
|
96169782 |
Dong_pope |
F |
Oct. 20, 2020, 5:02 p.m. |
OK |
GNU C++14 |
TESTS |
32 |
62 |
0 |
|
|
96206943 |
Mihai145 |
F |
Oct. 21, 2020, 5:50 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
62 |
102400 |
|
|
96204490 |
naughtyb0y |
F |
Oct. 21, 2020, 5:11 a.m. |
OK |
GNU C++14 |
TESTS |
254 |
62 |
716800 |
|
|
96177923 |
iprakhar22 |
F |
Oct. 20, 2020, 6:22 p.m. |
OK |
GNU C++14 |
TESTS |
235 |
62 |
921600 |
|
|
remove filters
Back to search problems