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'Tina has a square grid with n rows and n columns. Each cell in the grid is either 0 or 1 . Tina wants to reduce the grid by a factor of k ( k is a divisor of n ). To do this, Tina splits the grid into k x k nonoverlapping blocks of cells such that every cell belongs to exactly one block. Tina then replaces each block of cells with a single cell equal to the value of the cells in the block. It is guaranteed that every cell in the same block has the same value. For example, the following demonstration shows a grid being reduced by factor of 3 . Help Tina reduce the grid by a factor of k . The first line contains t ( 1 <= q t <= q 100 ) xe2 x80 x93 the number of test cases. The first line of each test case contains two integers n and k ( 1 <= q n <= q 1000 , 1 <= k <= n , k is a divisor of n ) -- the number of rows and columns of the grid, and the factor that Tina wants to reduce the grid by. Each of the following n lines contain n characters describing the cells of the grid. Each character is either 0 or 1 . It is guaranteed every k by k block has the same value. It is guaranteed the sum of n over all test cases does not exceed 1000 . For each test case, output the grid reduced by a factor of k on a new line. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
272860248 |
AhmadEsam |
B |
July 26, 2024, 6:16 p.m. |
OK |
C# 10 |
TESTS |
5 |
155 |
3174400 |
|
|
272850128 |
chikuiui |
B |
July 26, 2024, 5:04 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
31 |
0 |
|
|
272910452 |
NoOb_MASTER07 |
B |
July 27, 2024, 5:44 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272905545 |
kislayraj |
B |
July 27, 2024, 5:02 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272905291 |
hashi_rama |
B |
July 27, 2024, 4:59 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272901667 |
Vampire04 |
B |
July 27, 2024, 4:20 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272896827 |
03shree |
B |
July 27, 2024, 3:27 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272889970 |
shadowdonland |
B |
July 27, 2024, 2:08 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272880966 |
CapClark |
B |
July 26, 2024, 11:03 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272881527 |
freak_in |
B |
July 26, 2024, 11:17 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272910968 |
ibrahimhanifceker |
B |
July 27, 2024, 5:49 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
5 |
46 |
0 |
|
|
272852078 |
akkshit_19 |
B |
July 26, 2024, 5:26 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272904221 |
Aakash__G970 |
B |
July 27, 2024, 4:48 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272901446 |
tanmoysarkar46552 |
B |
July 27, 2024, 4:18 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272888461 |
codinavia |
B |
July 27, 2024, 1:50 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272886092 |
yyashm1491625 |
B |
July 27, 2024, 1:08 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272884721 |
ZUHAYER_ |
B |
July 27, 2024, 12:37 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272876853 |
hadyrm0hamed |
B |
July 26, 2024, 9:38 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272855461 |
Hritik_git |
B |
July 26, 2024, 5:42 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272853772 |
Pratham_Arya |
B |
July 26, 2024, 5:34 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
31 |
0 |
|
|
272912593 |
vrishtiup |
B |
July 27, 2024, 6:01 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
5 |
46 |
0 |
|
|
272867004 |
mhmdkardosha |
B |
July 26, 2024, 7:21 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
30 |
0 |
|
|
272860862 |
kovir_aleksey_korroy |
B |
July 26, 2024, 6:21 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272907171 |
mavc |
B |
July 27, 2024, 5:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272888268 |
StillABrokie |
B |
July 27, 2024, 1:47 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272884600 |
Alex_Sense1 |
B |
July 27, 2024, 12:34 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272881754 |
Jague402 |
B |
July 26, 2024, 11:23 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272876105 |
SharvanCN1 |
B |
July 26, 2024, 9:25 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272866283 |
vjudge.5 |
B |
July 26, 2024, 7:12 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272866036 |
AlexanderGarifullin |
B |
July 26, 2024, 7:10 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272863323 |
flick007 |
B |
July 26, 2024, 6:43 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
5 |
31 |
0 |
|
|
272878093 |
bluemegane |
B |
July 26, 2024, 10 p.m. |
OK |
C# 8 |
TESTS |
5 |
93 |
3276800 |
|
|
272856784 |
Anonymous_HF |
B |
July 26, 2024, 5:52 p.m. |
OK |
GNU C11 |
TESTS |
5 |
46 |
1126400 |
|
|
272863503 |
theshadman007 |
B |
July 26, 2024, 6:45 p.m. |
OK |
GNU C11 |
TESTS |
5 |
312 |
1024000 |
|
|
272865176 |
Yapson |
B |
July 26, 2024, 7:01 p.m. |
OK |
GNU C11 |
TESTS |
5 |
327 |
102400 |
|
|
272855447 |
biswajit_k9796 |
B |
July 26, 2024, 5:42 p.m. |
OK |
GNU C11 |
TESTS |
5 |
327 |
1024000 |
|
|
272890282 |
crapcode |
B |
July 27, 2024, 2:12 a.m. |
OK |
GNU C11 |
TESTS |
5 |
342 |
1024000 |
|
|
272898474 |
Ay1n_Das |
B |
July 27, 2024, 3:44 a.m. |
OK |
GNU C11 |
TESTS |
5 |
343 |
102400 |
|
|
272866588 |
hiyanshu |
B |
July 26, 2024, 7:16 p.m. |
OK |
GNU C11 |
TESTS |
5 |
343 |
921600 |
|
|
272891668 |
ShiroeWT |
B |
July 27, 2024, 2:29 a.m. |
OK |
GNU C11 |
TESTS |
5 |
343 |
4096000 |
|
|
272850507 |
xjhdamn |
B |
July 26, 2024, 5:04 p.m. |
OK |
GNU C11 |
TESTS |
5 |
390 |
2048000 |
|
|
272896745 |
salmanswe |
B |
July 27, 2024, 3:26 a.m. |
OK |
Go |
TESTS |
5 |
62 |
1228800 |
|
|
272875767 |
batroe24 |
B |
July 26, 2024, 9:19 p.m. |
OK |
Go |
TESTS |
5 |
686 |
5120000 |
|
|
272875666 |
batroe24 |
B |
July 26, 2024, 9:17 p.m. |
OK |
Go |
TESTS |
5 |
749 |
4608000 |
|
|
272877192 |
zendel |
B |
July 26, 2024, 9:44 p.m. |
OK |
Haskell |
TESTS |
5 |
62 |
0 |
|
|
272871072 |
rj3377295 |
B |
July 26, 2024, 8:11 p.m. |
OK |
Java 21 |
TESTS |
5 |
202 |
204800 |
|
|
272881141 |
sagbis |
B |
July 26, 2024, 11:07 p.m. |
OK |
Java 21 |
TESTS |
5 |
217 |
512000 |
|
|
272883248 |
gdax |
B |
July 27, 2024, 12:01 a.m. |
OK |
Java 21 |
TESTS |
5 |
218 |
614400 |
|
|
272896088 |
ktcat |
B |
July 27, 2024, 3:18 a.m. |
OK |
Java 21 |
TESTS |
5 |
249 |
0 |
|
|
272903526 |
Nagendravarma |
B |
July 27, 2024, 4:41 a.m. |
OK |
Java 21 |
TESTS |
5 |
249 |
307200 |
|
|
272907769 |
InfinityX |
B |
July 27, 2024, 5:21 a.m. |
OK |
Java 21 |
TESTS |
5 |
249 |
614400 |
|
|
272860911 |
ankush9140 |
B |
July 26, 2024, 6:21 p.m. |
OK |
Java 21 |
TESTS |
5 |
249 |
614400 |
|
|
272876031 |
Ziko-09 |
B |
July 26, 2024, 9:24 p.m. |
OK |
Java 21 |
TESTS |
5 |
249 |
1331200 |
|
|
272888136 |
ChongQY |
B |
July 27, 2024, 1:46 a.m. |
OK |
Java 21 |
TESTS |
5 |
265 |
26112000 |
|
|
272911227 |
aankitkrr |
B |
July 27, 2024, 5:51 a.m. |
OK |
Java 21 |
TESTS |
5 |
280 |
1331200 |
|
|
272888867 |
BlizGale |
B |
July 27, 2024, 1:55 a.m. |
OK |
Java 8 |
TESTS |
5 |
139 |
0 |
|
|
272869687 |
suraj1771singh |
B |
July 26, 2024, 7:53 p.m. |
OK |
Java 8 |
TESTS |
5 |
140 |
0 |
|
|
272866472 |
CipherSphinx_Raj |
B |
July 26, 2024, 7:15 p.m. |
OK |
Java 8 |
TESTS |
5 |
155 |
39219200 |
|
|
272902008 |
Ovetsar_ilish |
B |
July 27, 2024, 4:24 a.m. |
OK |
Java 8 |
TESTS |
5 |
171 |
0 |
|
|
272864041 |
2manas1 |
B |
July 26, 2024, 6:50 p.m. |
OK |
Java 8 |
TESTS |
5 |
202 |
0 |
|
|
272904733 |
xsmoker |
B |
July 27, 2024, 4:54 a.m. |
OK |
Java 8 |
TESTS |
5 |
203 |
0 |
|
|
272872264 |
KONGO11 |
B |
July 26, 2024, 8:26 p.m. |
OK |
Java 8 |
TESTS |
5 |
234 |
0 |
|
|
272912221 |
noobCoder45 |
B |
July 27, 2024, 5:58 a.m. |
OK |
Java 8 |
TESTS |
5 |
249 |
0 |
|
|
272908503 |
agcwha2567 |
B |
July 27, 2024, 5:28 a.m. |
OK |
Java 8 |
TESTS |
5 |
265 |
0 |
|
|
272904594 |
sanjeevKumar1903 |
B |
July 27, 2024, 4:52 a.m. |
OK |
Java 8 |
TESTS |
5 |
265 |
0 |
|
|
272881266 |
blkrop |
B |
July 26, 2024, 11:10 p.m. |
OK |
Kotlin 1.9 |
TESTS |
5 |
171 |
102400 |
|
|
272860166 |
Martinien_ENSAF |
B |
July 26, 2024, 6:16 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
171 |
5632000 |
|
|
272878613 |
victorjiangvj |
B |
July 26, 2024, 10:10 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
202 |
11366400 |
|
|
272909197 |
sanjay000323 |
B |
July 27, 2024, 5:34 a.m. |
OK |
PyPy 3 |
TESTS |
5 |
218 |
10342400 |
|
|
272892260 |
nealzane |
B |
July 27, 2024, 2:37 a.m. |
OK |
PyPy 3 |
TESTS |
5 |
233 |
5529600 |
|
|
272854851 |
Tomik585 |
B |
July 26, 2024, 5:39 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
249 |
9728000 |
|
|
272906295 |
Youarenotgood |
B |
July 27, 2024, 5:08 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
77 |
2662400 |
|
|
272866474 |
JR1der |
B |
July 26, 2024, 7:15 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
78 |
2867200 |
|
|
272868070 |
YhuanDebeste |
B |
July 26, 2024, 7:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
1740800 |
|
|
272879542 |
Meyou100 |
B |
July 26, 2024, 10:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
1945600 |
|
|
272855345 |
brickster241 |
B |
July 26, 2024, 5:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
2662400 |
|
|
272901503 |
callmeabhi |
B |
July 27, 2024, 4:18 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
2764800 |
|
|
272903010 |
AI_Brained |
B |
July 27, 2024, 4:35 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
3072000 |
|
|
272878597 |
kinglykang |
B |
July 26, 2024, 10:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
3379200 |
|
|
272884106 |
katonyonko |
B |
July 27, 2024, 12:23 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
3481600 |
|
|
272879882 |
BLACK-HEAD |
B |
July 26, 2024, 10:35 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
93 |
3481600 |
|
|
272873253 |
kshitijtmalpure1907 |
B |
July 26, 2024, 8:40 p.m. |
OK |
Python 3 |
TESTS |
5 |
62 |
0 |
|
|
272861969 |
Ashwinr_07 |
B |
July 26, 2024, 6:30 p.m. |
OK |
Python 3 |
TESTS |
5 |
62 |
0 |
|
|
272885085 |
def337485 |
B |
July 27, 2024, 12:46 a.m. |
OK |
Python 3 |
TESTS |
5 |
62 |
1536000 |
|
|
272850323 |
balakarthik99 |
B |
July 26, 2024, 5:04 p.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
819200 |
|
|
272872041 |
kkkk1234 |
B |
July 26, 2024, 8:23 p.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
1024000 |
|
|
272889448 |
infj1 |
B |
July 27, 2024, 2:02 a.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
1433600 |
|
|
272889324 |
infj1 |
B |
July 27, 2024, 2 a.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
1536000 |
|
|
272912582 |
nanitecore |
B |
July 27, 2024, 6:01 a.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
2355200 |
|
|
272900780 |
Rajeev_29 |
B |
July 27, 2024, 4:10 a.m. |
OK |
Python 3 |
TESTS |
5 |
78 |
0 |
|
|
272878208 |
arturpin |
B |
July 26, 2024, 10:02 p.m. |
OK |
Python 3 |
TESTS |
5 |
78 |
1126400 |
|
|
remove filters
Back to search problems