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 15:08highload-churnerhighload-churnerScore: 2,715,712Success
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 15:102,709,5171,095,119,8921,082,752,0001,055,0002,121,728stderr
2Oct 12, 2026 15:102,710,2601,093,877,7871,083,101,0001,003,0002,121,728stderr
3Oct 12, 2026 15:102,711,4451,094,806,9541,083,482,0001,096,0002,121,728stderr
4Oct 12, 2026 15:102,713,6321,095,085,8101,084,412,0001,041,0002,121,728stderr
5Oct 12, 2026 15:102,715,7121,095,152,8471,085,268,0001,017,0002,121,728stderr
6Oct 12, 2026 15:102,716,1571,096,365,1001,085,408,0001,055,0002,121,728stderr
7Oct 12, 2026 15:102,718,6671,099,158,6391,086,369,0001,098,0002,121,728stderr
8Oct 12, 2026 15:102,718,8871,098,148,0241,086,503,0001,052,0002,121,728stderr
9Oct 12, 2026 15:102,720,4701,097,132,1951,087,184,0001,004,0002,121,728stderr