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'A matrix of size n x m is called nice, if all rows and columns of the matrix are palindromes. A sequence of integers (a_1, a_2, ... , a_k) is a palindrome, if for any integer i ( 1 <= i <= k ) the equality a_i = a_{k - i + 1} holds. Sasha owns a matrix a of size n x m . In one operation he can increase or decrease any number in the matrix by one. Sasha wants to make the matrix nice. He is interested what is the minimum number of operations he needs. Help him! The first line contains a single integer t -- the number of test cases ( 1 <= t <= 10 ). The t tests follow. The first line of each test contains two integers n and m ( 1 <= n, m <= 100 ) -- the size of the matrix. Each of the next n lines contains m integers a_{i, j} ( 0 <= a_{i, j} <= 10^9 ) -- the elements of the matrix. For each test output the smallest number of operations required to make the matrix nice. In the first test case we can, for example, obtain the following nice matrix in 8 operations: In the second test case we can, for example, obtain the following nice matrix in 42 operations: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
94738965 |
cheese-cracker |
B |
Oct. 5, 2020, 5:44 a.m. |
OK |
D |
TESTS |
7 |
61 |
1843200 |
|
|
94700373 |
Gassa |
B |
Oct. 4, 2020, 5:29 p.m. |
OK |
D |
TESTS |
7 |
93 |
1945600 |
|
|
94717143 |
prince17 |
B |
Oct. 4, 2020, 7:33 p.m. |
OK |
FPC |
TESTS |
7 |
46 |
102400 |
|
|
94725237 |
CTP_314 |
B |
Oct. 4, 2020, 11:45 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
15 |
102400 |
|
|
94728326 |
blue_lotus |
B |
Oct. 5, 2020, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
30 |
102400 |
|
|
94739541 |
MengWH |
B |
Oct. 5, 2020, 5:54 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
30 |
307200 |
|
|
94736532 |
hnie_king_wxl |
B |
Oct. 5, 2020, 5:01 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94734690 |
Young.EQ |
B |
Oct. 5, 2020, 4:23 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94732245 |
YJJ_Konnyaku |
B |
Oct. 5, 2020, 3:30 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94729337 |
Leidaxxb |
B |
Oct. 5, 2020, 2:19 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94728309 |
B1GGersnow |
B |
Oct. 5, 2020, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94712732 |
caroulder |
B |
Oct. 4, 2020, 6:34 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94709845 |
a1s3a |
B |
Oct. 4, 2020, 6:04 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
31 |
0 |
|
|
94699599 |
seeker_26 |
B |
Oct. 4, 2020, 5:27 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
102400 |
|
|
94728490 |
Tanishq_Gupta |
B |
Oct. 5, 2020, 1:54 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
204800 |
|
|
94727482 |
thaizhenleng |
B |
Oct. 5, 2020, 1:22 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
204800 |
|
|
94727099 |
Manoj_Parihar |
B |
Oct. 5, 2020, 1:09 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
204800 |
|
|
94722259 |
tate |
B |
Oct. 4, 2020, 9:41 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
204800 |
|
|
94732139 |
Pankaj_Kumar1 |
B |
Oct. 5, 2020, 3:28 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
30 |
307200 |
|
|
94730937 |
zzugzx |
B |
Oct. 5, 2020, 3 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
31 |
0 |
|
|
94721286 |
vivace_jr |
B |
Oct. 4, 2020, 9:09 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
31 |
0 |
|
|
94718648 |
satyamjaiswal012 |
B |
Oct. 4, 2020, 8:01 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
31 |
0 |
|
|
94718612 |
satyamjaiswal012 |
B |
Oct. 4, 2020, 8 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
31 |
0 |
|
|
94737043 |
Dreamy_boy |
B |
Oct. 5, 2020, 5:11 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
0 |
|
|
94700880 |
Daroga53 |
B |
Oct. 4, 2020, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
0 |
|
|
94701115 |
Mumtahin_mahmud |
B |
Oct. 4, 2020, 5:32 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
102400 |
|
|
94712931 |
MrDracuLa |
B |
Oct. 4, 2020, 6:36 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
204800 |
|
|
94702073 |
anup_coder |
B |
Oct. 4, 2020, 5:35 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
204800 |
|
|
94720245 |
pj423 |
B |
Oct. 4, 2020, 8:41 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
30 |
307200 |
|
|
94739553 |
jatinarora135 |
B |
Oct. 5, 2020, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
31 |
102400 |
|
|
94737843 |
focusedranger |
B |
Oct. 5, 2020, 5:24 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
31 |
102400 |
|
|
94737173 |
hegdetejasn |
B |
Oct. 5, 2020, 5:13 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
31 |
102400 |
|
|
94735120 |
ShlokG |
B |
Oct. 5, 2020, 4:32 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
31 |
102400 |
|
|
94738735 |
alif_cse_ju |
B |
Oct. 5, 2020, 5:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
102400 |
|
|
94731031 |
gameofcodes |
B |
Oct. 5, 2020, 3:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
102400 |
|
|
94726625 |
Jame___boy |
B |
Oct. 5, 2020, 12:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
102400 |
|
|
94716909 |
ishu0805 |
B |
Oct. 4, 2020, 7:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
102400 |
|
|
94712826 |
lucid_dreamer |
B |
Oct. 4, 2020, 6:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
102400 |
|
|
94712607 |
d_p_beladiya |
B |
Oct. 4, 2020, 6:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
30 |
204800 |
|
|
94728165 |
DQYZ_HWK |
B |
Oct. 5, 2020, 1:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
31 |
0 |
|
|
94714888 |
StalkerShurik |
B |
Oct. 4, 2020, 6:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
31 |
0 |
|
|
94705214 |
_.- |
B |
Oct. 4, 2020, 5:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
31 |
0 |
|
|
94739961 |
agarwala2512 |
B |
Oct. 5, 2020, 6:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
31 |
102400 |
|
|
94714914 |
takezawa |
B |
Oct. 4, 2020, 6:57 p.m. |
OK |
Go |
TESTS |
7 |
93 |
4505600 |
|
|
94737443 |
RuthlessAggression |
B |
Oct. 5, 2020, 5:18 a.m. |
OK |
Java 11 |
TESTS |
7 |
186 |
0 |
|
|
94713068 |
Jevin |
B |
Oct. 4, 2020, 6:37 p.m. |
OK |
Java 11 |
TESTS |
7 |
186 |
0 |
|
|
94710905 |
soumit915 |
B |
Oct. 4, 2020, 6:23 p.m. |
OK |
Java 11 |
TESTS |
7 |
186 |
0 |
|
|
94735025 |
sf14t |
B |
Oct. 5, 2020, 4:30 a.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94730084 |
srjvastri8 |
B |
Oct. 5, 2020, 2:39 a.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94714474 |
cribabby |
B |
Oct. 4, 2020, 6:52 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94711305 |
aCitizen |
B |
Oct. 4, 2020, 6:25 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94708235 |
alanbaade |
B |
Oct. 4, 2020, 5:59 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94706398 |
Lucifer__89 |
B |
Oct. 4, 2020, 5:52 p.m. |
OK |
Java 11 |
TESTS |
7 |
187 |
0 |
|
|
94730217 |
nickjosi |
B |
Oct. 5, 2020, 2:43 a.m. |
OK |
Java 11 |
TESTS |
7 |
202 |
0 |
|
|
94739636 |
aym_05 |
B |
Oct. 5, 2020, 5:55 a.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
0 |
|
|
94713303 |
blackmamba23 |
B |
Oct. 4, 2020, 6:39 p.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
0 |
|
|
94712600 |
procrastinate7 |
B |
Oct. 4, 2020, 6:33 p.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
0 |
|
|
94722876 |
Billert |
B |
Oct. 4, 2020, 9:57 p.m. |
OK |
Java 8 |
TESTS |
7 |
109 |
0 |
|
|
94722274 |
coolManit |
B |
Oct. 4, 2020, 9:41 p.m. |
OK |
Java 8 |
TESTS |
7 |
109 |
0 |
|
|
94707059 |
xXAyushiXx |
B |
Oct. 4, 2020, 5:54 p.m. |
OK |
Java 8 |
TESTS |
7 |
109 |
0 |
|
|
94738919 |
shivang_1234 |
B |
Oct. 5, 2020, 5:43 a.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
94734514 |
jagrit_07 |
B |
Oct. 5, 2020, 4:19 a.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
94719627 |
sumitnitesh123 |
B |
Oct. 4, 2020, 8:25 p.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
94719353 |
toufique_husein |
B |
Oct. 4, 2020, 8:17 p.m. |
OK |
Java 8 |
TESTS |
7 |
124 |
0 |
|
|
94735997 |
Spheniscine |
B |
Oct. 5, 2020, 4:50 a.m. |
OK |
Kotlin |
TESTS |
7 |
155 |
1536000 |
|
|
94708689 |
LoL000 |
B |
Oct. 4, 2020, 6 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
61 |
307200 |
|
|
94703241 |
aynurnizamov |
B |
Oct. 4, 2020, 5:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
93 |
102400 |
|
|
94702312 |
itised |
B |
Oct. 4, 2020, 5:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
93 |
102400 |
|
|
94739521 |
pandoomanda |
B |
Oct. 5, 2020, 5:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
108 |
102400 |
|
|
94732044 |
Pathlessbark8 |
B |
Oct. 5, 2020, 3:26 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
108 |
102400 |
|
|
94712498 |
ustaritz |
B |
Oct. 4, 2020, 6:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
108 |
102400 |
|
|
94709165 |
Tuenjuko |
B |
Oct. 4, 2020, 6:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
108 |
204800 |
|
|
94734201 |
Torehalt |
B |
Oct. 5, 2020, 4:12 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
109 |
102400 |
|
|
94704690 |
AbdelkareemEmara |
B |
Oct. 4, 2020, 5:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
109 |
102400 |
|
|
94717393 |
dominotim |
B |
Oct. 4, 2020, 7:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
109 |
204800 |
|
|
94739051 |
realnimish |
B |
Oct. 5, 2020, 5:45 a.m. |
OK |
PyPy 2 |
TESTS |
7 |
171 |
6451200 |
|
|
94740124 |
yumtam |
B |
Oct. 5, 2020, 6:03 a.m. |
OK |
PyPy 2 |
TESTS |
7 |
202 |
7680000 |
|
|
94738053 |
Anuranjan_Pandey |
B |
Oct. 5, 2020, 5:28 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
170 |
4096000 |
|
|
94711586 |
manhar |
B |
Oct. 4, 2020, 6:26 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
171 |
4096000 |
|
|
94716355 |
ritiksingh2020 |
B |
Oct. 4, 2020, 7:19 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
217 |
5222400 |
|
|
94704495 |
thnkndblv |
B |
Oct. 4, 2020, 5:45 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
233 |
6758400 |
|
|
94733070 |
chill_house |
B |
Oct. 5, 2020, 3:49 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
234 |
5939200 |
|
|
94715980 |
FlakeLCR |
B |
Oct. 4, 2020, 7:13 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
248 |
5324800 |
|
|
94716798 |
ritiksingh2020 |
B |
Oct. 4, 2020, 7:27 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
249 |
5222400 |
|
|
94737148 |
ss7890 |
B |
Oct. 5, 2020, 5:13 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
249 |
5324800 |
|
|
94723329 |
mrinal2233 |
B |
Oct. 4, 2020, 10:14 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
264 |
5427200 |
|
|
94717655 |
sergiunasca |
B |
Oct. 4, 2020, 7:41 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
264 |
5427200 |
|
|
94721838 |
boogeymanJW |
B |
Oct. 4, 2020, 9:26 p.m. |
OK |
Python 2 |
TESTS |
7 |
311 |
307200 |
|
|
94720619 |
IngaleAnkur10 |
B |
Oct. 4, 2020, 8:50 p.m. |
OK |
Python 3 |
TESTS |
7 |
155 |
512000 |
|
|
94705612 |
kazeyoshi |
B |
Oct. 4, 2020, 5:49 p.m. |
OK |
Python 3 |
TESTS |
7 |
155 |
614400 |
|
|
94705148 |
Player001 |
B |
Oct. 4, 2020, 5:47 p.m. |
OK |
Python 3 |
TESTS |
7 |
155 |
614400 |
|
|
94717529 |
hitesh_gulwani |
B |
Oct. 4, 2020, 7:39 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
512000 |
|
|
94708892 |
sul3 |
B |
Oct. 4, 2020, 6:01 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
512000 |
|
|
94703288 |
sid_121212 |
B |
Oct. 4, 2020, 5:40 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
512000 |
|
|
94734535 |
wolpiskerter |
B |
Oct. 5, 2020, 4:20 a.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
614400 |
|
|
94724545 |
pratikgarai020801 |
B |
Oct. 4, 2020, 11:07 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
614400 |
|
|
94706432 |
Gausstein |
B |
Oct. 4, 2020, 5:52 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
614400 |
|
|
94702506 |
tskhada |
B |
Oct. 4, 2020, 5:37 p.m. |
OK |
Python 3 |
TESTS |
7 |
171 |
819200 |
|
|
94719064 |
wow_ok |
B |
Oct. 4, 2020, 8:10 p.m. |
OK |
Ruby |
TESTS |
7 |
686 |
1945600 |
|
|
94726897 |
anvorguesa |
B |
Oct. 5, 2020, 1:02 a.m. |
OK |
Rust |
TESTS |
7 |
46 |
204800 |
|
|
remove filters
Back to search problems