MetaHackerCup-2025 [](./LICENSE)

January 7, 2026 ยท View on GitHub

  • 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. A 6-minute timer is set for uploading the result this year.
  • A problem was marked as Very Hard means that it was an unsolved one during the contest and may not be that difficult.

Rounds

Practice Round

#TitleSolutionTimeSpaceDifficultyTagNote
AWarm UpPython3 Python3 Python3O(N)O(N)EasyHash Table, Sort, Topological Sort
BZone InPython3O(R * C)O(1)EasyBFS, Flood Fill
CMonkey AroundPython3O(N)O(N)EasyConstructive Algorithms, Prefix Sum
DPlan OutPython3 Python3O(N + M)O(N + M)MediumBFS, Flood Fill, Union Find, Euler Path
EPay OffPython3O(QlogQ + (N + Q) * logN)O(N + Q)HardSorted List, Binary Search

Round 1

#TitleSolutionTimeSpaceDifficultyTagNote
A1Snake Scales (Chapter 1)Python3O(N)O(1)EasyArray
A2Snake Scales (Chapter 2)Python3 Python3O(NlogN)O(N)EasySort, Binary Search, BFS, Union Find
B1Final Product (Chapter 1)Python3O(N)O(1)EasyConstructive Algorithms
B2Final Product (Chapter 2)Python3O(sqrt(B))O(logB)EasyNumber Theory, Combinatorics, Stars and Bars
CNarrowing DownPython3O(N)O(N)EasyPrefix Sum
DCrash CoursePython3O(N)O(1)MediumGame Theory

Round 2

#TitleSolutionTimeSpaceDifficultyTagNote
ADeciding PointsPython3O(1)O(1)EasyMath
BDefining PrizesPython3O(M + NlogN)O(N)EasyFreq Table, Sort, Binary Search
CDesigning PathsPython3O(N + SlogS)O(N + S)MediumSorted List, BFS
DDividing PasscodesPyPy3precompute: O(9 * MAX_K * 2^MAX_K)
runtime: O(9 * min(logR, K))
O(MAX_K * 2^MAX_K)HardBitmasks, DP
EDescending PlatformsPyPy3O(N^3)O(N^2)HardPrefix Sum, Greedy, DP, Backtracing, Difference Array

Round 3

#TitleSolutionTimeSpaceDifficultyTagNote
APatchwork PyramidPython3O(N^2)O(N^2)MediumConstructive Algorithms
BStreetlamp SafetyPython3O(N^2)O(N)EasyPrefix Sum, DP
CAdversarial AttackPyPy3O(N * (L + (logL)^2 * K / 64))O(L + K / 64)HardKMP, Bitset DP, Binary Lifting
DTreehouse TelegramPython3O(N * (logN)^2)O(N)MediumHLD, LCA, Principle of Inclusion and Exclusion
EBitstring BotcheckPython3O(N^2)O(N)HardPrecompute, BFS, Bitmasks, Constructive Algorithms, Invariants

Final Round

You can relive the magic of the 2025 Hacker Cup World Finals by watching the Live Stream Recording of the announcement of winners.

#TitleSolutionTimeSpaceDifficultyTagNote
ASupermarket ShiftsPython3O(M + NlogN)O(N)EasyBIT, Fenwick Tree, Inversions
BPolishing ProblemsPython3O(L + T * (C + K * F * N / 64) + TlogT)O(L)HardMath, Freq Table, Sliding Window, Bag of Words, Quick Select, LCS, Bitset DP
C1Cube Coloring (Chapter 1)Python3O(N^3)O(N^2)MediumConstructive Algorithms
C2Cube Coloring (Chapter 2)Python3O(N^2 + M^3)O(N^2)HardConstructive Algorithms
DWiring WreathsPython3O(N^3 * logN)O(N)MediumTarjan's Algorithm, BCCs, Biconnected Components, DFS, Bitmasks, Binary Search, Greedy, Backtracking, Pruning, Prefix Sum
ELonesome LookoutPyPy3O(N + LlogL)O(N + L)MediumCombinatorics, NTT, Garner's Algorithm, Principle of Inclusion and Exclusion
FReindeer RallyPython3O(M^2 * RlogR / 64 + N * MlogM)O(N * M + R * M^2 / 64)HardBinary Splitting, Bitset DP, Backtracing, EGZ Theorem