GoogleCodeJam 2022 [](./LICENSE)

April 16, 2023 · View on GitHub

  • Python3 solutions of Google Code Jam 2022. Solution begins with * means it will get TLE in the largest data set.
  • Total computation amount > 10^8 is not friendly for Python3 to solve in 5 ~ 15 seconds.
  • A problem was marked as Very Hard means that it was an unsolved one during the contest and may not be that difficult.

Rounds

Qualification Round

#TitleSolutionTimeSpaceDifficultyTagNote
APunched CardsPython3O(R * C)O(1)EasyArray
B3D PrintingPython3O(1)O(1)EasyMath
Cd1000000PyPy3 Python3O(NlogN)O(1)EasySort
DChain ReactionsPython3 Python3O(N)O(N)MediumTopological Sort, Greedy
ETwisty Little PassagesPython3 Python3O(min(K, N))O(min(K, N))HardProbability, Importance Sampling

Round 1A

#TitleSolutionTimeSpaceDifficultyTagNote
ADouble or One ThingPython3O(|S|)O(1)EasyString
BEqual SumPython3 Python3O(N)O(1)MediumMath, Constructive Algorithms
CWeightliftingPython3O(E^2 * W + E^3)O(E^2 + W)HardDP

Round 1B

#TitleSolutionTimeSpaceDifficultyTagNote
APancake DequePython3O(N)O(1)EasyGreedy
BControlled InflationPython3O(N * P)O(1)MediumDP
CASeDatAbPython3 Python3 Python3O(L * 2^L)O(L)HardPrecompute, BFS, Topological Sort, Constructive Algorithms

Round 1C

#TitleSolutionTimeSpaceDifficultyTagNote
ALetter BlocksPython3O(N * L)O(N)EasyString
BSquaryPython3O(N)O(1)MediumMath, Constructive Algorithms
CIntranetsPython3 Python3precompute: O(MAX_M)
runtime: O(1)
O(MAX_M)HardInclusion‐Exclusion Principle, Combinatorics, Catalan Number

Round 2

#TitleSolutionTimeSpaceDifficultyTagNote
ASpiraling Into ControlPython3O(N)O(1)EasyConstructive Algorithms, Greedy, Math
BPixelated CirclePython3O(R)O(1)MediumMath
CSaving the JellyPyPy3O(N^2 * sqrt(N))O(N^2)MediumBipartite Matching, Hopcroft-Karp Algorithm
DI, O BotPython3O(NlogN)O(N)HardDP, Prefix Sum, Hash Table

Round 3

#TitleSolutionTimeSpaceDifficultyTagNote
ARevenge of GoroSortPython3O(C * N)O(N)EasyMath, Expected Value, Trial and Error
BDuck, Duck, GeesePyPy3 C++O(NlogN)O(N)MediumSegment Tree
CMascot MazePython3O(N)O(N)MediumTopological Sort, Greedy
DWin As SecondPython3 Python3 Python3 PyPy3precompute: O(N^5) on average
runtime: O(N^3 + M * N^2)
O(N^2)HardBitmasks, Submask Enumeration, Sprague-Grundy Theorem, BFS, Constructive Algorithms, Precompute, Trial and Error

Virtual World Finals

You can relive the magic of the 2022 Code Jam Virtual World Finals by watching the Live Stream Recording of the competition, problem explanations, and announcement of winners.

#TitleSolutionTimeSpaceDifficultyTagNote
AWonderland ChasePython3O(J + C)O(J + C)EasyGraph, BFS
BGoose, Goose, Ducks?*PyPy3 C++O(N + M + S * (logM + logS))O(N + S)HardLogic-Based, Sorted List, Graph, BFS, SCC, Tarjan's Algorithm
CSlide ParadePyPy3O(B * S + S^2)O(B * S)MediumBFS, Constructive Algorithms, Bipartite Matching, Hungarian Algorithm, Eulerian Path, Hierholzer's Algorithm
DSchrödinger and PavlovPyPy3O(N)O(N)Hard❤️Graph, Probability, DP
ETrianglesPyPy3 C++O(N^2)O(N)Very Hard❤️Geometry, Constructive Algorithms, Greedy