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 25, 2026 10:09C21C21Score: 57,227Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 25, 2026 10:1256,95733,730,07721,757,0001,026,0002,117,632
2Oct 25, 2026 10:1256,96733,703,00921,772,0001,015,0002,113,536
3Oct 25, 2026 10:1257,13235,489,89821,746,0001,107,0002,113,536
4Oct 25, 2026 10:1257,17733,824,78621,805,0001,066,0002,113,536
5Oct 25, 2026 10:1257,22733,860,92421,807,0001,084,0002,113,536
6Oct 25, 2026 10:1257,23033,875,94521,795,0001,097,0002,113,536
7Oct 25, 2026 10:1257,26233,905,88921,810,0001,095,0002,113,536
8Oct 25, 2026 10:1257,36033,893,17521,753,0001,191,0002,113,536
9Oct 25, 2026 10:1257,39034,400,60321,862,0001,094,0002,113,536