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'There is a matrix of size n x n which consists of 0s and 1s. The rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. The cell at the intersection of the x -th row and the y -th column is denoted as (x, y) . AquaMoon wants to turn all elements of the matrix to 0s. In one step she can perform the following operation: Help AquaMoon determine the minimum number of steps she need to perform to turn all elements of the matrix to 0s. We can show that an answer always exists. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. The first line of each test case contains an integer n ( 2 <= n <= 3000 ). The i -th of the following n lines contains a binary string only of characters 0 and 1, of length n . It is guaranteed that the sum of n^2 over all test cases does not exceed 9 ,000 ,000 . For each test case, print the minimum number of steps. In the first test case, we can use the following scheme: Clearly, the elements of the initial matrix are not all 0, so at least one operation is required. Thus, 1 is the answer. In the second test case, we use the following scheme: It can be shown that there is no way to convert all elements to 0s in 0 or 1 steps, so the answer is exactly 2 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
220631460 |
tahtarovserver |
D |
Aug. 27, 2023, 3:38 a.m. |
OK |
C# 10 |
TESTS |
58 |
873 |
3481600 |
|
|
220582633 |
khongvaodcLQD2023 |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
C# 8 |
TESTS |
58 |
904 |
131584000 |
|
|
220607076 |
NenadDapic |
D |
Aug. 26, 2023, 7:49 p.m. |
OK |
FPC |
TESTS |
58 |
1138 |
9011200 |
|
|
220597300 |
Ginjupalli_Avinash |
D |
Aug. 26, 2023, 5:34 p.m. |
OK |
GNU C11 |
TESTS |
58 |
717 |
117043200 |
|
|
220632869 |
zhangzhimo |
D |
Aug. 27, 2023, 4:05 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
155 |
89190400 |
|
|
220630525 |
xu826281112 |
D |
Aug. 27, 2023, 3:19 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
156 |
121856000 |
|
|
220591064 |
Zzzcr |
D |
Aug. 26, 2023, 5:10 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
171 |
76595200 |
|
|
220586642 |
xiaxiakeji |
D |
Aug. 26, 2023, 4:53 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
202 |
372838400 |
|
|
220620826 |
hhoangcp |
D |
Aug. 26, 2023, 11:21 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
218 |
72601600 |
|
|
220582491 |
Vania_Javadi |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
248 |
118169600 |
|
|
220596567 |
Razvan_Rotaru |
D |
Aug. 26, 2023, 5:31 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
249 |
72396800 |
|
|
220582594 |
hhhxxxyyy3 |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
264 |
72396800 |
|
|
220587496 |
taochenyu |
D |
Aug. 26, 2023, 4:56 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
265 |
102400 |
|
|
220633391 |
TrendBattles |
D |
Aug. 27, 2023, 4:15 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
265 |
81408000 |
|
|
220583584 |
InvictusOcean |
D |
Aug. 26, 2023, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
217 |
81408000 |
|
|
220615769 |
amlelephant_fan |
D |
Aug. 26, 2023, 9:33 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
233 |
144793600 |
|
|
220587867 |
mohammadsam |
D |
Aug. 26, 2023, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
234 |
54681600 |
|
|
220633504 |
wrong_answer_on_test2 |
D |
Aug. 27, 2023, 4:17 a.m. |
OK |
GNU C++17 |
TESTS |
58 |
234 |
108544000 |
|
|
220633145 |
Starry516 |
D |
Aug. 27, 2023, 4:10 a.m. |
OK |
GNU C++17 |
TESTS |
58 |
248 |
290713600 |
|
|
220590787 |
Knightshade |
D |
Aug. 26, 2023, 5:09 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
249 |
13926400 |
|
|
220593456 |
AR69420 |
D |
Aug. 26, 2023, 5:19 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
249 |
27238400 |
|
|
220587644 |
Vibhor_Gupta |
D |
Aug. 26, 2023, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
249 |
144486400 |
|
|
220592802 |
downfall |
D |
Aug. 26, 2023, 5:17 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
264 |
13926400 |
|
|
220615139 |
dreamy_jasper |
D |
Aug. 26, 2023, 9:23 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
265 |
36454400 |
|
|
220621197 |
lunchbox |
D |
Aug. 26, 2023, 11:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
202 |
36249600 |
|
|
220582078 |
Fighoh |
D |
Aug. 26, 2023, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
217 |
27545600 |
|
|
220593529 |
lxllxs |
D |
Aug. 26, 2023, 5:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
217 |
153804800 |
|
|
220609043 |
Cosysl |
D |
Aug. 26, 2023, 8:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
218 |
14438400 |
|
|
220608942 |
Cosysl |
D |
Aug. 26, 2023, 8:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
218 |
14438400 |
|
|
220593857 |
brianlee0415 |
D |
Aug. 26, 2023, 5:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
218 |
300748800 |
|
|
220588079 |
pigstar_fan |
D |
Aug. 26, 2023, 4:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
234 |
52224000 |
|
|
220587540 |
sbzx |
D |
Aug. 26, 2023, 4:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
248 |
10240000 |
|
|
220639360 |
BK0717-KC |
D |
Aug. 27, 2023, 5:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
249 |
73932800 |
|
|
220587407 |
CHN_OMoon |
D |
Aug. 26, 2023, 4:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
249 |
81715200 |
|
|
220631521 |
BurnedChicken |
D |
Aug. 27, 2023, 3:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
124 |
18124800 |
|
|
220626900 |
zhangguangxuan99 |
D |
Aug. 27, 2023, 2:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
124 |
83763200 |
|
|
220586067 |
leonard123 |
D |
Aug. 26, 2023, 4:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
140 |
102400 |
|
|
220630235 |
coderdhanraj |
D |
Aug. 27, 2023, 3:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
140 |
11776000 |
|
|
220607040 |
BlankYang |
D |
Aug. 26, 2023, 7:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
140 |
81510400 |
|
|
220618975 |
AkramElOmrani |
D |
Aug. 26, 2023, 10:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
155 |
144486400 |
|
|
220632171 |
DanRan02 |
D |
Aug. 27, 2023, 3:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
155 |
145305600 |
|
|
220630977 |
waku111 |
D |
Aug. 27, 2023, 3:28 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
155 |
145305600 |
|
|
220582583 |
AliVu |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
156 |
204800 |
|
|
220629757 |
learn_cute |
D |
Aug. 27, 2023, 3:06 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
156 |
11878400 |
|
|
220584229 |
O_Vladimir |
D |
Aug. 26, 2023, 4:45 p.m. |
OK |
Go |
TESTS |
58 |
655 |
200499200 |
|
|
220593010 |
weawemam |
D |
Aug. 26, 2023, 5:18 p.m. |
OK |
Go |
TESTS |
58 |
779 |
5120000 |
|
|
220593162 |
duck_man123 |
D |
Aug. 26, 2023, 5:18 p.m. |
OK |
Java 11 |
TESTS |
58 |
826 |
144076800 |
|
|
220606347 |
IMP0STER |
D |
Aug. 26, 2023, 7:45 p.m. |
OK |
Java 11 |
TESTS |
58 |
1356 |
139673600 |
|
|
220593524 |
aryang22 |
D |
Aug. 26, 2023, 5:20 p.m. |
OK |
Java 11 |
TESTS |
58 |
1481 |
261427200 |
|
|
220587483 |
saksham_s |
D |
Aug. 26, 2023, 4:56 p.m. |
OK |
Java 11 |
TESTS |
58 |
1528 |
153292800 |
|
|
220582615 |
bobib |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
Java 11 |
TESTS |
58 |
1699 |
248729600 |
|
|
220624022 |
wizardleen |
D |
Aug. 27, 2023, 12:50 a.m. |
OK |
Java 17 |
TESTS |
58 |
655 |
50790400 |
|
|
220582370 |
Ligh0x74 |
D |
Aug. 26, 2023, 4:38 p.m. |
OK |
Java 17 |
TESTS |
58 |
670 |
19251200 |
|
|
220606711 |
dzhi |
D |
Aug. 26, 2023, 7:47 p.m. |
OK |
Java 17 |
TESTS |
58 |
732 |
153804800 |
|
|
220589843 |
not_just_rr |
D |
Aug. 26, 2023, 5:05 p.m. |
OK |
Java 17 |
TESTS |
58 |
857 |
146944000 |
|
|
220595144 |
wizardleen |
D |
Aug. 26, 2023, 5:26 p.m. |
OK |
Java 17 |
TESTS |
58 |
857 |
318464000 |
|
|
220592673 |
vijaypanwar_12 |
D |
Aug. 26, 2023, 5:16 p.m. |
OK |
Java 17 |
TESTS |
58 |
951 |
258252800 |
|
|
220607440 |
tushar19280 |
D |
Aug. 26, 2023, 7:52 p.m. |
OK |
Java 17 |
TESTS |
58 |
1513 |
417484800 |
|
|
220593287 |
vaiibhav75 |
D |
Aug. 26, 2023, 5:19 p.m. |
OK |
Java 17 |
TESTS |
58 |
1809 |
147763200 |
|
|
220591411 |
-----x |
D |
Aug. 26, 2023, 5:11 p.m. |
OK |
Java 17 |
TESTS |
58 |
1840 |
146022400 |
|
|
220582685 |
mohitkumarmahto576 |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
Java 17 |
TESTS |
58 |
1949 |
147865600 |
|
|
220606337 |
vijay_panwar12 |
D |
Aug. 26, 2023, 7:45 p.m. |
OK |
Java 8 |
TESTS |
58 |
685 |
281088000 |
|
|
220582464 |
vatsal_04 |
D |
Aug. 26, 2023, 4:39 p.m. |
OK |
Java 8 |
TESTS |
58 |
748 |
209817600 |
|
|
220593825 |
priyaroy3370 |
D |
Aug. 26, 2023, 5:21 p.m. |
OK |
Java 8 |
TESTS |
58 |
842 |
214732800 |
|
|
220586606 |
a3g1s |
D |
Aug. 26, 2023, 4:53 p.m. |
OK |
Java 8 |
TESTS |
58 |
1107 |
135270400 |
|
|
220586917 |
UniversalAdmin |
D |
Aug. 26, 2023, 4:54 p.m. |
OK |
Java 8 |
TESTS |
58 |
1824 |
450764800 |
|
|
220594951 |
HuTao_Oya_OyaOya |
D |
Aug. 26, 2023, 5:25 p.m. |
OK |
Kotlin 1.7 |
TESTS |
58 |
1263 |
240537600 |
|
|
220590981 |
romegenix666 |
D |
Aug. 26, 2023, 5:09 p.m. |
OK |
Kotlin 1.7 |
TESTS |
58 |
1403 |
49561600 |
|
|
220586481 |
shubhamkumar1001 |
D |
Aug. 26, 2023, 4:53 p.m. |
OK |
Kotlin 1.7 |
TESTS |
58 |
1481 |
223436800 |
|
|
220592428 |
Eldar_H1 |
D |
Aug. 26, 2023, 5:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
58 |
1029 |
36249600 |
|
|
220582016 |
vajaba |
D |
Aug. 26, 2023, 4:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
58 |
1309 |
72192000 |
|
|
220591675 |
iinaamasum |
D |
Aug. 26, 2023, 5:12 p.m. |
OK |
PyPy 3 |
TESTS |
58 |
1154 |
11673600 |
|
|
220609623 |
abcsumits |
D |
Aug. 26, 2023, 8:13 p.m. |
OK |
PyPy 3 |
TESTS |
58 |
1747 |
10854400 |
|
|
220608329 |
andy0liang |
D |
Aug. 26, 2023, 8 p.m. |
OK |
PyPy 3 |
TESTS |
58 |
1949 |
58572800 |
|
|
220631651 |
gardengnome |
D |
Aug. 27, 2023, 3:41 a.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
545 |
14336000 |
|
|
220631899 |
gardengnome |
D |
Aug. 27, 2023, 3:46 a.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
561 |
14336000 |
|
|
220591361 |
cybsbbb |
D |
Aug. 26, 2023, 5:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
592 |
15155200 |
|
|
220611087 |
siddharthraj |
D |
Aug. 26, 2023, 8:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
608 |
27545600 |
|
|
220606579 |
NKM |
D |
Aug. 26, 2023, 7:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
623 |
11366400 |
|
|
220607918 |
pifagorgor |
D |
Aug. 26, 2023, 7:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
639 |
12390400 |
|
|
220611246 |
siddharthraj |
D |
Aug. 26, 2023, 8:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
655 |
27340800 |
|
|
220627866 |
xuanwoshiluo |
D |
Aug. 27, 2023, 2:25 a.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
655 |
43724800 |
|
|
220611900 |
siddharthraj |
D |
Aug. 26, 2023, 8:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
686 |
27340800 |
|
|
220611400 |
siddharthraj |
D |
Aug. 26, 2023, 8:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
686 |
27443200 |
|
|
220616908 |
pili |
D |
Aug. 26, 2023, 9:52 p.m. |
OK |
Rust 2021 |
TESTS |
58 |
436 |
56832000 |
|
|
220584976 |
NotnaKO |
D |
Aug. 26, 2023, 4:47 p.m. |
OK |
Rust 2021 |
TESTS |
58 |
1029 |
512000 |
|
|
220592780 |
serious_black89 |
D |
Aug. 26, 2023, 5:16 p.m. |
OK |
Rust 2021 |
TESTS |
58 |
1294 |
151961600 |
|
|
220596669 |
SDUFE_ACM |
D |
Aug. 26, 2023, 5:31 p.m. |
OK |
Rust 2021 |
TESTS |
58 |
1450 |
150732800 |
|
|
220596937 |
vaibhav2740 |
D |
Aug. 26, 2023, 5:32 p.m. |
OK |
Scala |
TESTS |
58 |
1590 |
63283200 |
|
|
remove filters
Back to search problems