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 listAug 18, 2025 02:43Yuriy LyfenkoYuriy LyfenkoError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 5, 2026 20:31Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 5, 2026 20:35014,521,869,20614,498,709,00012,257,0002,117,632expected "2", got "50 "
2Oct 5, 2026 20:3506,201,170,8336,178,797,00011,053,0002,117,632expected "31", got "50 "
3Oct 5, 2026 20:3505,423,420,5795,400,184,00012,080,0002,117,632expected "49", got "50 "
4Aug 18, 2025 02:4320,43030,408,9106,129,0002,043,0002,281,472
5Aug 18, 2025 02:4321,99325,723,8476,598,0002,199,0002,281,472
6Aug 18, 2025 02:4322,88330,433,1077,119,0002,034,0002,273,280
7Aug 18, 2025 02:4323,49325,108,4408,353,0001,044,0002,277,376
8Aug 18, 2025 02:4323,58524,236,0588,386,0001,048,0002,277,376
9Aug 18, 2025 02:4323,77526,933,8538,454,0001,056,0002,523,136
10Aug 18, 2025 02:4323,79026,866,2469,516,00002,281,472
11Aug 18, 2025 02:4324,25829,357,5459,703,00002,277,376
12Aug 18, 2025 02:4324,77030,647,9188,918,000990,0002,519,040