Largest Square Submatrix of all 1's 
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
Restrictions:60s256Mb 1 Score Packages
CPU Information
| Model | Intel(R) Xeon(R) CPU E3-1271 v3 @ 3.60GHz |
| Cores | 1 |
Extensions
fpuvmedepsetscmsrpaemcecx8apicsepmtrrpgemcacmovpatpse36clflushdtsacpimmxfxsrssesse2sshttmpbesyscallnxpdpe1gbrdtscplmconstant_tscarch_perfmonpebsbtsrep_goodnoplxtopologynonstop_tsccpuidaperfmperfpnipclmulqdqdtes64monitords_cplsmxesttm2ssse3sdbgfmacx16xtprpdcmpcidsse4_1sse4_2x2apicmovbepopcnttsc_deadline_timeraesxsaveavxf16crdrandlahf_lmabmcpuid_faultepbptissbdibrsibpbstibpfsgsbasetsc_adjustbmi1avx2smepbmi2ermsinvpcidxsaveoptdthermaratplnptsmd_clearflush_l1dibpb_exit_to_user
Installed Packages
Feel free to create an issue if you need an extra library from the standard Ubuntu repository.
| Name | Version | Description |
|---|---|---|
| libc6-dev | 2.39-0ubuntu8.7 | GNU C Library: Development Libraries and Header Files Contains the symlinks, headers, and object files needed to compile and link programs which use the standard C library. |
| libclang-common-14-dev | 1:14.0.6-19build4 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-15-dev | 1:15.0.7-14build3 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-16-dev | 1:16.0.6-23ubuntu4 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-17-dev | 1:17.0.6-9ubuntu1 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-18-dev | 1:18.1.3-1ubuntu1 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-19-dev | 1:19.1.1-1ubuntu1~24.04.2 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libclang-common-20-dev | 1:20.1.2-0ubuntu1~24.04.2 | Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). . Clang implements all of the ISO C++ 1998, 11, 14 and 17 standards and also provides most of the support of C++20. . This package contains the Clang generic headers. |
| libcrypt-dev | 1:4.4.36-4build1 | libcrypt development files This package contains the files needed for developing applications that use libcrypt. |
| libgcc-10-dev | 10.5.0-4ubuntu2.1 | GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. |
| libgcc-11-dev | 11.5.0-1ubuntu1~24.04.1 | GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. |
| libgcc-12-dev | 12.4.0-2ubuntu1~24.04.1 | GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. |
| libgcc-13-dev | 13.3.0-6ubuntu2~24.04.1 | GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. |
| libgcc-14-dev | 14.2.0-4ubuntu2~24.04.1 | GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. |
| libobjc-13-dev | 13.3.0-6ubuntu2~24.04.1 | Runtime library for GNU Objective-C applications (development files) This package contains the headers and static library files needed to build GNU ObjC applications. |
| libssl-dev | 3.0.13-0ubuntu3.9 | Secure Sockets Layer toolkit - development files This package is part of the OpenSSL project's implementation of the SSL and TLS cryptographic protocols for secure communication over the Internet. . It contains development libraries, header files, and manpages for libssl and libcrypto. |
| libstdc++-10-dev | 10.5.0-4ubuntu2.1 | GNU Standard C++ Library v3 (development files) This package contains the headers and static library files necessary for building C++ programs which use libstdc++. . libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0. |
| libstdc++-11-dev | 11.5.0-1ubuntu1~24.04.1 | GNU Standard C++ Library v3 (development files) This package contains the headers and static library files necessary for building C++ programs which use libstdc++. . libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0. |
| libstdc++-12-dev | 12.4.0-2ubuntu1~24.04.1 | GNU Standard C++ Library v3 (development files) This package contains the headers and static library files necessary for building C++ programs which use libstdc++. . libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0. |
| libstdc++-13-dev | 13.3.0-6ubuntu2~24.04.1 | GNU Standard C++ Library v3 (development files) This package contains the headers and static library files necessary for building C++ programs which use libstdc++. . libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0. |
| libstdc++-14-dev | 14.2.0-4ubuntu2~24.04.1 | GNU Standard C++ Library v3 (development files) This package contains the headers and static library files necessary for building C++ programs which use libstdc++. . libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which was included up to g++-2.95. The first version of libstdc++-v3 appeared in g++-3.0. |
| libtbb-dev | 2021.11.0-2ubuntu2 | parallelism library for C++ - development files TBB is a library that helps you leverage multi-core processor performance without having to be a threading expert. It represents a higher-level, task-based parallelism that abstracts platform details and threading mechanism for performance and scalability. . (Note: if you are a user of the i386 architecture, i.e., 32-bit Intel or compatible hardware, this package only supports Pentium4-compatible and higher processors.) . This package includes the TBB development files. |
Source Code
Source code access is restricted. Log in to request access.
Challenge History
No challenges yet.
Run Statistics
| # | Date | Score | Wall Time | CPU User | CPU System | Memory | Error | |
|---|---|---|---|---|---|---|---|---|
| 1 | Apr 26, 2026 21:52 | 93,150 | 56,584,141 | 33,232,000 | 4,028,000 | 2,314,240 | ||
| 2 | Apr 26, 2026 21:52 | 94,367 | 53,871,046 | 31,787,000 | 5,960,000 | 2,306,048 | ||
| 3 | Apr 26, 2026 21:52 | 95,050 | 58,263,245 | 32,017,000 | 6,003,000 | 2,310,144 | ||
| 4 | Apr 26, 2026 21:52 | 97,787 | 59,687,000 | 31,092,000 | 8,023,000 | 2,310,144 | ||
| 5 | Apr 26, 2026 21:52 | 99,745 | 59,252,336 | 32,916,000 | 6,982,000 | 2,318,336 | ||
| 6 | Apr 26, 2026 21:52 | 99,952 | 56,840,450 | 31,985,000 | 7,996,000 | 2,322,432 | ||
| 7 | Apr 26, 2026 21:52 | 100,187 | 61,923,666 | 34,064,000 | 6,011,000 | 2,318,336 | ||
| 8 | Apr 26, 2026 21:52 | 102,795 | 56,892,612 | 34,098,000 | 7,020,000 | 2,314,240 | ||
| 9 | Apr 26, 2026 21:52 | 104,490 | 58,087,449 | 34,830,000 | 6,966,000 | 2,314,240 |