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 08:55apuxbtapuxbtScore: 828,347Success
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 08:56827,170341,052,761329,826,0001,042,0002,113,536
2Sep 16, 2026 08:56827,437341,188,324329,924,0001,051,0002,113,536
3Sep 16, 2026 08:56828,235341,491,753330,264,0001,030,0002,113,536
4Sep 16, 2026 08:56828,337341,571,700331,335,00002,113,536
5Sep 16, 2026 08:56828,347341,492,449330,336,0001,003,0002,113,536
6Sep 16, 2026 08:56828,940341,850,533330,536,0001,040,0002,113,536
7Sep 16, 2026 08:56829,105341,840,164330,619,0001,023,0002,113,536
8Sep 16, 2026 08:56829,207342,038,567330,677,0001,006,0002,113,536
9Sep 16, 2026 08:56829,615342,069,892330,791,0001,055,0002,113,536