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 listSep 25, 2026 19:39Kevin HeaveyKevin HeaveyError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 25, 2026 19:390593,585,154529,946,00053,355,00020,480Exit with code 3: bg=11 nb=64 [0,7193-18,7211:19] [1,7637-25,7661:25] [5,453-21,469:17] [20,3076-70,3125:50] [30,5810-75,5855:46] [62,1899-98,1935:37] [65,4586-110,4631:46] [85,9044-98,9057:14] [97,6965-142,7010:46] [106,4258-149,4301:44] [117,3602-131...stderr