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 consisting of n rows and m columns. Each cell of this matrix contains 0 or 1 . Let's call a square of size 2 x 2 without one corner cell an L-shape figure. In one operation you can take one L-shape figure, with at least one cell containing 1 and replace all numbers in it with zeroes. Find the maximum number of operations that you can do with the given matrix. The first line contains one integer t ( 1 <= q t <= q 500 ) -- the number of test cases. Then follow the descriptions of each test case. The first line of each test case contains two integers n and m ( 2 <= q n, m <= q 500 ) -- the size of the matrix. Each of the following n lines contains a binary string of length m -- the description of the matrix. It is guaranteed that the sum of n and the sum of m over all test cases does not exceed 1000 . For each test case output the maximum number of operations you can do with the given matrix. In the first testcase one of the optimal sequences of operations is the following (bold font shows l-shape figure on which operation was performed): In the third testcase from the sample we can not perform any operation because the matrix doesn't contain any ones. In the fourth testcase it does not matter which L-shape figure we pick in our first operation. We will always be left with single one. So we will perform 2 operations. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
168917296 |
6-_-9 |
C |
Aug. 19, 2022, 4:24 a.m. |
OK |
C# 10 |
TESTS |
10 |
124 |
1843200 |
|
|
168914026 |
luyifan |
C |
Aug. 19, 2022, 3:29 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
10 |
233 |
3174400 |
|
|
168904684 |
quochuong2006 |
C |
Aug. 19, 2022, 12:33 a.m. |
OK |
FPC |
TESTS |
10 |
31 |
1433600 |
|
|
168880494 |
NenadDapic |
C |
Aug. 18, 2022, 5:59 p.m. |
OK |
FPC |
TESTS |
10 |
46 |
307200 |
|
|
168888211 |
NenadDapic |
C |
Aug. 18, 2022, 7:16 p.m. |
OK |
FPC |
TESTS |
10 |
46 |
614400 |
|
|
168908940 |
Leasier |
C |
Aug. 19, 2022, 2:03 a.m. |
OK |
GNU C11 |
TESTS |
10 |
31 |
1024000 |
|
|
168872464 |
suraj.xd |
C |
Aug. 18, 2022, 5 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
1126400 |
|
|
168918308 |
kashu7644 |
C |
Aug. 19, 2022, 4:40 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168904257 |
Theredemptionv3 |
C |
Aug. 19, 2022, 12:21 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168899118 |
razoncdr |
C |
Aug. 18, 2022, 10:02 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168896461 |
Paresh15 |
C |
Aug. 18, 2022, 9:05 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168889139 |
himanshukumarbhu |
C |
Aug. 18, 2022, 7:26 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168886417 |
kalashj93 |
C |
Aug. 18, 2022, 6:56 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168881722 |
subbudatti18 |
C |
Aug. 18, 2022, 6:10 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168876656 |
concun123 |
C |
Aug. 18, 2022, 5:29 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168919943 |
Hriday_Sutradhar |
C |
Aug. 19, 2022, 5:04 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
15 |
204800 |
|
|
168922846 |
Satyam_86770 |
C |
Aug. 19, 2022, 5:39 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168919162 |
kohli716 |
C |
Aug. 19, 2022, 4:53 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168917945 |
yash2603 |
C |
Aug. 19, 2022, 4:34 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168917622 |
SAHIN_ |
C |
Aug. 19, 2022, 4:29 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168917433 |
sabrina_mostafa |
C |
Aug. 19, 2022, 4:26 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168915598 |
ennnkayyy |
C |
Aug. 19, 2022, 3:56 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168914419 |
sheikhfoysal |
C |
Aug. 19, 2022, 3:35 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168912821 |
Oniket2000 |
C |
Aug. 19, 2022, 3:12 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168908701 |
_Iso_ |
C |
Aug. 19, 2022, 1:58 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168919415 |
DhirajD |
C |
Aug. 19, 2022, 4:57 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
15 |
204800 |
|
|
168876207 |
Prabhat0602 |
C |
Aug. 18, 2022, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
204800 |
|
|
168914216 |
Leonard |
C |
Aug. 19, 2022, 3:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168862735 |
knaveenreddy021 |
C |
Aug. 18, 2022, 3:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
409600 |
|
|
168908476 |
Haven_ |
C |
Aug. 19, 2022, 1:54 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
1126400 |
|
|
168902740 |
RetsaZC19 |
C |
Aug. 18, 2022, 11:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
1126400 |
|
|
168897630 |
_rAkib |
C |
Aug. 18, 2022, 9:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
1126400 |
|
|
168872676 |
nksrivastava18 |
C |
Aug. 18, 2022, 5:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
15 |
102400 |
|
|
168919289 |
1potato2potato |
C |
Aug. 19, 2022, 4:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
15 |
102400 |
|
|
168923051 |
Ahnaf_ |
C |
Aug. 19, 2022, 5:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
15 |
204800 |
|
|
168910365 |
Sakib62 |
C |
Aug. 19, 2022, 2:29 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
15 |
204800 |
|
|
168904500 |
tensai1 |
C |
Aug. 19, 2022, 12:27 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
204800 |
|
|
168922493 |
not_me__ |
C |
Aug. 19, 2022, 5:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
204800 |
|
|
168915104 |
mimat_coder |
C |
Aug. 19, 2022, 3:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168912349 |
huqingyun123 |
C |
Aug. 19, 2022, 3:04 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168912234 |
mmdsl |
C |
Aug. 19, 2022, 3:02 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168917637 |
ZJC123 |
C |
Aug. 19, 2022, 4:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168917585 |
abc.followers |
C |
Aug. 19, 2022, 4:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168916874 |
VIP_IITBHU |
C |
Aug. 19, 2022, 4:17 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168916385 |
Allan_vasc |
C |
Aug. 19, 2022, 4:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168915135 |
IAlsoHateMyself |
C |
Aug. 19, 2022, 3:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
307200 |
|
|
168873509 |
koqo |
C |
Aug. 18, 2022, 5:07 p.m. |
OK |
Go |
TESTS |
10 |
30 |
307200 |
|
|
168881404 |
SkadiTheCorruptHeart |
C |
Aug. 18, 2022, 6:07 p.m. |
OK |
Java 11 |
TESTS |
10 |
170 |
0 |
|
|
168864399 |
praduman14 |
C |
Aug. 18, 2022, 3:34 p.m. |
OK |
Java 11 |
TESTS |
10 |
170 |
0 |
|
|
168923357 |
yerkebayev |
C |
Aug. 19, 2022, 5:45 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168910541 |
vijender_8601 |
C |
Aug. 19, 2022, 2:32 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168906954 |
Prime369 |
C |
Aug. 19, 2022, 1:24 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168905729 |
satyaa_78 |
C |
Aug. 19, 2022, 12:57 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168892895 |
_mza |
C |
Aug. 18, 2022, 8:10 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168878511 |
kasiru_69 |
C |
Aug. 18, 2022, 5:44 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168874622 |
AyushS_cg170 |
C |
Aug. 18, 2022, 5:14 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168873164 |
Spidey2182 |
C |
Aug. 18, 2022, 5:04 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
168869905 |
ac9117033 |
C |
Aug. 18, 2022, 4:44 p.m. |
OK |
Java 17 |
TESTS |
10 |
171 |
307200 |
|
|
168901367 |
matzhao |
C |
Aug. 18, 2022, 11 p.m. |
OK |
Java 17 |
TESTS |
10 |
202 |
409600 |
|
|
168887960 |
CrinklyGolem |
C |
Aug. 18, 2022, 7:13 p.m. |
OK |
Java 17 |
TESTS |
10 |
202 |
512000 |
|
|
168882318 |
Suraj1607 |
C |
Aug. 18, 2022, 6:15 p.m. |
OK |
Java 17 |
TESTS |
10 |
217 |
0 |
|
|
168915637 |
lrczuiwudi666 |
C |
Aug. 19, 2022, 3:57 a.m. |
OK |
Java 17 |
TESTS |
10 |
233 |
512000 |
|
|
168877707 |
destroyer11 |
C |
Aug. 18, 2022, 5:38 p.m. |
OK |
Java 17 |
TESTS |
10 |
311 |
1024000 |
|
|
168915246 |
Virendra115 |
C |
Aug. 19, 2022, 3:50 a.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
168904181 |
xiuyuan-cao |
C |
Aug. 19, 2022, 12:19 a.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
168901906 |
Diaa12360 |
C |
Aug. 18, 2022, 11:16 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
168874851 |
govindrajput |
C |
Aug. 18, 2022, 5:16 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
168912595 |
Mohamed_A7med |
C |
Aug. 19, 2022, 3:08 a.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168912064 |
frey4 |
C |
Aug. 19, 2022, 2:59 a.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168887476 |
ahmedtawfik |
C |
Aug. 18, 2022, 7:07 p.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168871764 |
Swapniltri |
C |
Aug. 18, 2022, 4:55 p.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168870907 |
ankit_0207 |
C |
Aug. 18, 2022, 4:49 p.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168864148 |
PavneetSingh |
C |
Aug. 18, 2022, 3:34 p.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
168892098 |
kotrin |
C |
Aug. 18, 2022, 8 p.m. |
OK |
Kotlin 1.6 |
TESTS |
10 |
202 |
0 |
|
|
168873991 |
WhyYes |
C |
Aug. 18, 2022, 5:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
204800 |
|
|
168886266 |
cptahahab |
C |
Aug. 18, 2022, 6:55 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
307200 |
|
|
168868357 |
Vlasov211 |
C |
Aug. 18, 2022, 4:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
307200 |
|
|
168860899 |
forest000014 |
C |
Aug. 18, 2022, 3:26 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
307200 |
|
|
168914667 |
1_shivam |
C |
Aug. 19, 2022, 3:40 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
1433600 |
|
|
168907191 |
hiro220214 |
C |
Aug. 19, 2022, 1:29 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
2048000 |
|
|
168878756 |
Bu1izhnik |
C |
Aug. 18, 2022, 5:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
30 |
1126400 |
|
|
168874517 |
Tor_250 |
C |
Aug. 18, 2022, 5:14 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
46 |
307200 |
|
|
168887376 |
justc_o_d_e |
C |
Aug. 18, 2022, 7:06 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
62 |
204800 |
|
|
168904375 |
Agateth |
C |
Aug. 19, 2022, 12:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
62 |
307200 |
|
|
168897026 |
chrisc |
C |
Aug. 18, 2022, 9:15 p.m. |
OK |
Node.js |
TESTS |
10 |
343 |
29900800 |
|
|
168873393 |
1_2_3_4_5_9 |
C |
Aug. 18, 2022, 5:06 p.m. |
OK |
PyPy 2 |
TESTS |
10 |
140 |
15769600 |
|
|
168862455 |
rummansadik |
C |
Aug. 18, 2022, 3:30 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
109 |
3584000 |
|
|
168863568 |
amanpalariya |
C |
Aug. 18, 2022, 3:33 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
124 |
2560000 |
|
|
168888857 |
yashsarda2002 |
C |
Aug. 18, 2022, 7:23 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
124 |
2662400 |
|
|
168883221 |
binilj04 |
C |
Aug. 18, 2022, 6:23 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
124 |
4812800 |
|
|
168879376 |
MohamedHamed123 |
C |
Aug. 18, 2022, 5:51 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
140 |
2560000 |
|
|
168878698 |
depressed_UG |
C |
Aug. 18, 2022, 5:46 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
202 |
10649600 |
|
|
168903237 |
voicon |
C |
Aug. 18, 2022, 11:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
77 |
3788800 |
|
|
168898776 |
crapcode |
C |
Aug. 18, 2022, 9:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
78 |
4300800 |
|
|
168915403 |
nicku123 |
C |
Aug. 19, 2022, 3:53 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
78 |
5222400 |
|
|
168863927 |
alon22 |
C |
Aug. 18, 2022, 3:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
93 |
2662400 |
|
|
168913122 |
kidoil |
C |
Aug. 19, 2022, 3:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
93 |
3072000 |
|
|
168869072 |
biglunchdude |
C |
Aug. 18, 2022, 4:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
93 |
6144000 |
|
|
168872138 |
SophieHatter |
C |
Aug. 18, 2022, 4:57 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
93 |
6348800 |
|
|
168911549 |
etner User0286 MiguelAnMoVi |
C |
Aug. 19, 2022, 2:50 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
108 |
4403200 |
|
|
168877367 |
Lhohelhohehmm |
C |
Aug. 18, 2022, 5:35 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
108 |
4710400 |
|
|
168893422 |
SilverGodly |
C |
Aug. 18, 2022, 8:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
108 |
6246400 |
|
|
168878574 |
rr745 |
C |
Aug. 18, 2022, 5:45 p.m. |
OK |
Python 3 |
TESTS |
10 |
61 |
716800 |
|
|
168918638 |
thewrongmystery |
C |
Aug. 19, 2022, 4:46 a.m. |
OK |
Python 3 |
TESTS |
10 |
77 |
1638400 |
|
|
168864026 |
RashNuke |
C |
Aug. 18, 2022, 3:34 p.m. |
OK |
Python 3 |
TESTS |
10 |
93 |
1843200 |
|
|
168901269 |
samiksha_09 |
C |
Aug. 18, 2022, 10:58 p.m. |
OK |
Python 3 |
TESTS |
10 |
109 |
1638400 |
|
|
168860144 |
Fayord |
C |
Aug. 18, 2022, 3:25 p.m. |
OK |
Python 3 |
TESTS |
10 |
171 |
1638400 |
|
|
168911744 |
etner User0286 MiguelAnMoVi |
C |
Aug. 19, 2022, 2:54 a.m. |
OK |
Python 3 |
TESTS |
10 |
295 |
3686400 |
|
|
168869432 |
gla_191500066 |
C |
Aug. 18, 2022, 4:42 p.m. |
OK |
Python 3 |
TESTS |
10 |
296 |
3686400 |
|
|
168893032 |
yashsarda2002 |
C |
Aug. 18, 2022, 8:12 p.m. |
OK |
Python 3 |
TESTS |
10 |
327 |
512000 |
|
|
168863824 |
rjaiIITR |
C |
Aug. 18, 2022, 3:33 p.m. |
OK |
Python 3 |
TESTS |
10 |
342 |
1843200 |
|
|
168915162 |
cisco2022 |
C |
Aug. 19, 2022, 3:49 a.m. |
OK |
Python 3 |
TESTS |
10 |
420 |
512000 |
|
|
168879985 |
magnus.hegdahl |
C |
Aug. 18, 2022, 5:55 p.m. |
OK |
Rust 2021 |
TESTS |
10 |
15 |
409600 |
|
|
168874585 |
LittleFall |
C |
Aug. 18, 2022, 5:14 p.m. |
OK |
Rust 2021 |
TESTS |
10 |
15 |
614400 |
|
|
168874476 |
Hyrulia |
C |
Aug. 18, 2022, 5:13 p.m. |
OK |
Rust 2021 |
TESTS |
10 |
15 |
614400 |
|
|
remove filters
Back to search problems