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 16, 2026 09:13apuxbtapuxbtScore: 74,157Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 16, 2026 09:1473,42239,515,30521,737,0007,632,0002,113,536
2Sep 16, 2026 09:1473,50739,571,17421,637,0007,766,0002,113,536
3Sep 16, 2026 09:1473,79539,749,83121,795,0007,723,0002,113,536
4Sep 16, 2026 09:1473,97539,759,69621,864,0007,726,0002,113,536
5Sep 16, 2026 09:1474,15739,821,31921,904,0007,759,0002,113,536
6Sep 16, 2026 09:1474,25739,942,48421,738,0007,965,0002,113,536
7Sep 16, 2026 09:1474,54040,050,72621,775,0008,041,0002,113,536
8Sep 16, 2026 09:1474,84240,111,34521,831,0008,106,0002,113,536
9Sep 16, 2026 09:1474,99740,207,80822,003,0007,996,0002,113,536