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 12, 2026 16:08highload-churnerhighload-churnerScore: 2,770Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 12, 2026 16:092,5079,668,8541,003,00002,117,632stderr
2Oct 12, 2026 16:092,5659,918,2811,026,00002,117,632stderr
3Oct 12, 2026 16:092,7379,819,3231,095,00002,117,632stderr
4Oct 12, 2026 16:092,7679,833,0301,107,00002,117,632stderr
5Oct 12, 2026 16:092,7709,874,0071,108,00002,117,632stderr
6Oct 12, 2026 16:092,7729,762,3871,109,00002,117,632stderr
7Oct 12, 2026 16:092,7829,740,9831,113,00002,117,632stderr
8Oct 12, 2026 16:092,78710,233,7511,115,00002,117,632stderr
9Oct 12, 2026 16:092,8029,860,8781,121,00002,117,632stderr