- Python3 solutions of Meta Hacker Cup 2025. Solution begins with
*means it will get TLE in the largest data set. - Total computation amount >
10^8, which is not friendly for Python3 to solve in 5 ~ 15 seconds. A6-minutetimer is set for uploading the result this year. - A problem was marked as
Very Hardmeans that it was an unsolved one during the contest and may not be that difficult.
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| A | Warm Up | Python3 Python3 Python3 | O(N) | O(N) | Easy | Hash Table, Sort, Topological Sort | |
| B | Zone In | Python3 | O(R * C) | O(1) | Easy | BFS, Flood Fill | |
| C | Monkey Around | Python3 | O(N) | O(N) | Easy | Constructive Algorithms, Prefix Sum | |
| D | Plan Out | Python3 Python3 | O(N + M) | O(N + M) | Medium | BFS, Flood Fill, Union Find, Euler Path | |
| E | Pay Off | Python3 | O(QlogQ + (N + Q) * logN) | O(N + Q) | Hard | Sorted List, Binary Search |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| A1 | Snake Scales (Chapter 1) | Python3 | O(N) | O(1) | Easy | Array | |
| A2 | Snake Scales (Chapter 2) | Python3 Python3 | O(NlogN) | O(N) | Easy | Sort, Binary Search, BFS, Union Find | |
| B1 | Final Product (Chapter 1) | Python3 | O(N) | O(1) | Easy | Constructive Algorithms | |
| B2 | Final Product (Chapter 2) | Python3 | O(sqrt(B)) | O(logB) | Easy | Number Theory, Combinatorics, Stars and Bars | |
| C | Narrowing Down | Python3 | O(N) | O(N) | Easy | Prefix Sum | |
| D | Crash Course | Python3 | O(N) | O(1) | Medium | Game Theory |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| A | Deciding Points | Python3 | O(1) | O(1) | Easy | Math | |
| B | Defining Prizes | Python3 | O(M + NlogN) | O(N) | Easy | Freq Table, Sort, Binary Search | |
| C | Designing Paths | Python3 | O(N + SlogS) | O(N + S) | Medium | Sorted List, BFS | |
| D | Dividing Passcodes | PyPy3 | precompute: O(9 * MAX_K * 2^MAX_K) runtime: O(9 * min(logR, K)) |
O(MAX_K * 2^MAX_K) | Hard | Bitmasks, DP | |
| E | Descending Platforms | PyPy3 | O(N^3) | O(N^2) | Hard | Prefix Sum, Greedy, DP, Backtracing, Difference Array |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| A | Patchwork Pyramid | Python3 | O(N^2) | O(N^2) | Medium | Constructive Algorithms | |
| B | Streetlamp Safety | Python3 | O(N^2) | O(N) | Easy | Prefix Sum, DP | |
| C | Adversarial Attack | PyPy3 | O(N * (L + (logL)^2 * K / 64)) | O(L + K / 64) | Hard | KMP, Bitset DP, Binary Lifting | |
| D | Treehouse Telegram | Python3 | O(N * (logN)^2) | O(N) | Medium | HLD, LCA, Principle of Inclusion and Exclusion | |
| E | Bitstring Botcheck | Python3 | O(N^2) | O(N) | Hard | Precompute, BFS, Bitmasks, Constructive Algorithms, Invariants |
You can relive the magic of the 2025 Hacker Cup World Finals by watching the Live Stream Recording of the announcement of winners.
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| A | Supermarket Shifts | Python3 | O(M + NlogN) | O(N) | Easy | BIT, Fenwick Tree, Inversions | |
| B | Polishing Problems | Python3 | O(L + T * (C + K * F * N / 64) + TlogT) | O(L) | Hard | Math, Freq Table, Sliding Window, Bag of Words, Quick Select, LCS, Bitset DP | |
| C1 | Cube Coloring (Chapter 1) | Python3 | O(N^3) | O(N^2) | Medium | Constructive Algorithms | |
| C2 | Cube Coloring (Chapter 2) | Python3 | O(N^2 + M^3) | O(N^2) | Hard | Constructive Algorithms | |
| D | Wiring Wreaths | Python3 | O(N^3 * logN) | O(N) | Medium | Tarjan's Algorithm, BCCs, Biconnected Components, DFS, Bitmasks, Binary Search, Greedy, Backtracking, Pruning, Prefix Sum | |
| E | Lonesome Lookout | PyPy3 | O(N + LlogL) | O(N + L) | Medium | Combinatorics, NTT, Garner's Algorithm, Principle of Inclusion and Exclusion | |
| F | Reindeer Rally | Python3 | O(M^2 * RlogR / 64 + N * MlogM) | O(N * M + R * M^2 / 64) | Hard | Binary Splitting, Bitset DP, Backtracing, EGZ Theorem |