Largest Square Submatrix of all 1's Haha Expert

Find the largest square submatrix consisting entirely of 1s as fast as possible.

Input

A 10,000 x 10,000 matrix of uint8 values (0 or 1) on STDIN.

0, 1, 0, 1, 1
0, 1, 1, 1, 1
0, 0, 1, 0, 0
1, 0, 1, 1, 0

Output

Print the side length of the largest all-ones square submatrix to STDOUT. The answer is guaranteed to be greater than 1.

For the example above, the output is:

2
Back to listOct 19, 2026 13:38highload-churnerhighload-churnerScore: 5,325Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 19, 2026 13:395,16211,562,50902,065,0002,117,632stderr
2Oct 19, 2026 13:395,21511,663,64002,086,0002,117,632stderr
3Oct 19, 2026 13:395,21511,574,25502,086,0002,117,632stderr
4Oct 19, 2026 13:395,22211,651,84002,089,0002,117,632stderr
5Oct 19, 2026 13:395,32511,692,92802,130,0002,117,632stderr
6Oct 19, 2026 13:395,33011,712,33602,132,0002,117,632stderr
7Oct 19, 2026 13:395,33211,654,83802,133,0002,117,632stderr
8Oct 19, 2026 13:395,33711,674,95902,135,0002,117,632stderr
9Oct 19, 2026 13:395,52713,306,85802,211,0002,117,632stderr