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 listJun 12, 2025 21:52Franek KortaFranek KortaError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 07:33Haha Expert10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 07:370464,642,461454,888,0001,248,0002,121,728expected "300", got "128 "stderr
2Sep 7, 2026 07:370465,755,423456,203,0001,267,0002,121,728expected "300", got "128 "stderr
3Sep 7, 2026 07:370466,316,994456,761,0001,001,0002,121,728expected "300", got "128 "stderr
4Jun 12, 2025 21:521,116,365471,331,622445,548,000998,0002,420,736
5Jun 12, 2025 21:521,117,605468,638,104444,042,0003,000,0002,531,328
6Jun 12, 2025 21:511,117,988466,010,665446,195,0001,000,0002,269,184
7Jun 12, 2025 21:511,118,075472,189,439446,230,0001,000,0002,269,184
8Jun 12, 2025 21:521,118,513479,347,004446,407,000998,0002,269,184
9Jun 12, 2025 21:521,118,795472,405,101445,521,0001,997,0002,531,328
10Jun 12, 2025 21:511,118,930469,961,181445,574,0001,998,0002,428,928
11Jun 12, 2025 21:511,120,630475,193,379447,252,0001,000,0002,269,184
12Jun 12, 2025 21:511,120,725476,515,931448,290,00002,531,328
13Jun 12, 2025 21:521,120,815475,262,730448,326,00002,531,328
14Jun 12, 2025 21:521,121,438471,579,315447,576,000999,0002,428,928
15Jun 12, 2025 21:521,122,118476,604,097447,848,000999,0002,531,328
16Jun 12, 2025 21:521,122,280469,400,501447,913,000999,0002,531,328
17Jun 12, 2025 21:511,122,295474,236,141446,919,0001,999,0002,424,832
18Jun 12, 2025 21:511,122,923471,661,630449,169,00002,531,328
19Jun 12, 2025 21:511,122,975476,404,942449,190,00002,428,928
20Jun 12, 2025 21:511,122,993470,594,285449,197,00002,428,928
21Jun 12, 2025 21:521,123,393470,411,017449,357,00002,424,832