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 19, 2026 13:33Andrew EpsteinAndrew EpsteinScore: 1,967,392Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 19, 2026 14:071,963,922796,768,992784,298,0001,271,0002,117,632stderr
2Sep 19, 2026 14:071,966,217796,865,364785,485,0001,002,0002,117,632stderr
3Sep 19, 2026 14:071,966,287797,064,775785,512,0001,003,0002,117,632stderr
4Sep 19, 2026 14:071,966,785798,013,010785,713,0001,001,0002,117,632stderr
5Sep 19, 2026 14:071,967,392797,404,548785,956,0001,001,0002,117,632stderr
6Sep 19, 2026 14:071,967,810797,507,742785,964,0001,160,0002,117,632stderr
7Sep 19, 2026 14:071,969,652799,079,533786,860,0001,001,0002,117,632stderr
8Sep 19, 2026 14:071,970,132798,675,285785,940,0002,113,0002,117,632stderr
9Sep 19, 2026 14:071,971,902799,941,197787,761,0001,000,0002,117,632stderr