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:49highload-churnerhighload-churnerScore: 2,627Success
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:522,34711,008,477939,000028,672stderr
2Oct 9, 2026 18:522,4279,650,740971,000028,672stderr
3Oct 9, 2026 18:522,5129,629,6901,005,000028,672stderr
4Oct 9, 2026 18:522,5479,572,9681,019,000028,672stderr
5Oct 9, 2026 18:522,6279,696,9561,051,000028,672stderr
6Oct 9, 2026 18:522,6279,633,1451,051,000028,672stderr
7Oct 9, 2026 18:522,6359,764,0631,054,000028,672stderr
8Oct 9, 2026 18:522,6459,780,9401,058,000028,672stderr
9Oct 9, 2026 18:522,7759,842,9021,110,000028,672stderr