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 9, 2026 18:22highload-churnerhighload-churnerScore: 86,267Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 9, 2026 18:2485,80743,290,71028,271,0006,052,00028,672stderr
2Oct 9, 2026 18:2486,17743,600,40528,378,0006,093,00028,672stderr
3Oct 9, 2026 18:2486,23243,589,68728,451,0006,042,00028,672stderr
4Oct 9, 2026 18:2486,23744,094,77428,394,0006,101,00028,672stderr
5Oct 9, 2026 18:2486,26743,540,60128,408,0006,099,00028,672stderr
6Oct 9, 2026 18:2489,23544,817,66229,130,0006,564,00028,672stderr
7Oct 9, 2026 18:2496,23047,493,22431,912,0006,580,00028,672stderr
8Oct 9, 2026 18:2496,48047,590,69532,012,0006,580,00028,672stderr
9Oct 9, 2026 18:2499,23048,954,08733,636,0006,056,00028,672stderr