MetaHackerCup-2023 [](./LICENSE)

September 23, 2024 · View on GitHub

  • Python3 solutions of Meta Hacker Cup 2023. 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
A1Cheeseburger Corollary 1Python3O(1)O(1)EasyMath
A2Cheeseburger Corollary 2Python3O(1)O(1)MediumMath
BDim Sum DeliveryPython3O(1)O(1)EasyGame
CTwo Apples a DayPython3O(NlogN)O(1)EasySort, Two Pointers
DRoad to NutellaPython3 Python3O(N + M + QlogQ)O(N + M + Q)HardTarjan's Algorithm, Biconnected Components, DFS, Bipartite Coloring, BFS, LCA, Binary Lifting, Counting Sort, Union Find, DSU

Round 1

#TitleSolutionTimeSpaceDifficultyTagNote
AHere Comes Santa ClausPython3O(N)O(1)EasyMath
B1Sum 41 (Chapter 1)Python3 Python3 Python3precompute: O(sqrt(MAX_P))
runtime: O(logP + sqrt(P)/log(sqrt(P)))
O(sqrt(MAX_P) + K)EasyConstructive Algorithms, Greedy, Number Theory, Linear Sieve of Eratosthenes, Backtracking, Unique Partitions, Pruning
B2Sum 41 (Chapter 2)Python3 Python3O(89166 + K^2)O(K)MediumBacktracking, Unique Partitions, Pruning
C1Back in Black (Chapter 1)Python3O(NlogN + Q)O(N)EasyNumber Theory, Greedy
C2Back in Black (Chapter 2)Python3O(NlogN + Q)O(N)MediumNumber Theory, Greedy
DToday is Gonna be a Great DayPython3O(NlogN + QlogN)O(N)MediumSegment Tree
EBohemian Rap-sodyPyPy3O(QlogN + QlogQ + (L + Q) * sqrt(N))O(Q + N)HardTrie, Offline Solution, Binary Search, Sqrt Decomposition, Mo's Algorithm, Freq Table, Prefix Sum, Math

Round 2

#TitleSolutionTimeSpaceDifficultyTagNote
A1Ready, Go (Part 1)Python3O(R * C)O(R * C)EasyBFS
A2Ready, Go (Part 2)Python3O(R * C)O(R * C)EasyBFS, DP
BMeta GamePython3O(N)O(1)EasyArray
CWiki RacePython3 Python3O(N + SUM_LEN_S)O(N + SUM_LEN_S)MediumDFS, Freq Table, Tree DP
DTower RushPython3precompute: O(MAX_N + max(MAX_D, MAX_H) * log(max(MAX_D, MAX_H)))
runtime: O(N + (max_h) * log(max_h))
O(MAX_N + max(MAX_D, MAX_H) * log(max(MAX_D, MAX_H)))HardNumber Theory, Bézout's Identity, Combinatorics, Inclusion-Exclusion Principle, Möbius Function, Linear Sieve of Eratosthenes

Round 3

#TitleSolutionTimeSpaceDifficultyTagNote
ASpooky SplitsPython3O(S * sqrt(N) * logN)O(S * sqrt(N))EasyBFS, Backtracking, Pruning, Hash Table
BHash SlingerPython3O(N^2 + M^2)O(N * M)MediumDP, Dijkstra's Algorithm
CKrab-otagePython3O(R * C * (R + C))O(R * C)HardDP, Prefix Sum
DDouble StarsPython3 Python3O(N)O(N)HardDFS, BFS, Prefix Sum, Tree DP, Sort, Counting Sort, Freq Table, Two Pointers, Greedy
ESimilar ShipsPython3 Python3O(N)O(N)HardConstructive Algorithms, Tree Diameter, BFS, Tree DP

Final Round

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

#TitleSolutionTimeSpaceDifficultyTagNote
A1Programming Paths (Part 1)Python3 Python3precompute: O(R * C)
runtime: O(R * C)
O(R * C)EasyConstructive Algorithms, BFS, Bitmasks, DFS
A2Programming Paths (Part 2)Python3 Python3precompute: O(R * C + K^2 * D)
runtime: O(R * C)
O(R * C + K^2)HardConstructive Algorithms, BFS, DP, Backtracing
BTransposing TilesPyPy3O(R * C * 3136)O(R * C + 16)EasyFreq Table, DP
CResisting RobotsPython3O(NlogN + M)O(N + M)EasySort, Union Find, DSU, DP
DNearly NimPython3O(N)O(N)MediumGame, Prefix Sum, Greedy
EDealing DecksPyPy3O(NlogN)O(NlogN)MediumGame, Sprague-Grundy Theorem, Persistent Trie, Binary Search
FCacti CartographyPython3 Python3O(N^2 * min(K, L))O(N^2)HardCactus Graph, BFS, DFS, Tree DP, Linear Programming