- 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.
| # |
Title |
Solution |
Time |
Space |
Difficulty |
Tag |
Note |
| A |
Letter Blocks |
Python3 |
O(N * L) |
O(N) |
Easy |
|
String |
| B |
Squary |
Python3 |
O(N) |
O(1) |
Medium |
|
Math, Constructive Algorithms |
| C |
Intranets |
Python3 Python3 |
precompute: O(MAX_M) runtime: O(1) |
O(MAX_M) |
Hard |
|
Inclusion‐Exclusion Principle, Combinatorics, Catalan Number |
| # |
Title |
Solution |
Time |
Space |
Difficulty |
Tag |
Note |
| A |
Revenge of GoroSort |
Python3 |
O(C * N) |
O(N) |
Easy |
|
Math, Expected Value, Trial and Error |
| B |
Duck, Duck, Geese |
PyPy3 C++ |
O(NlogN) |
O(N) |
Medium |
|
Segment Tree |
| C |
Mascot Maze |
Python3 |
O(N) |
O(N) |
Medium |
|
Topological Sort, Greedy |
| D |
Win As Second |
Python3 Python3 Python3 PyPy3 |
precompute: O(N^5) on average runtime: O(N^3 + M * N^2) |
O(N^2) |
Hard |
|
Bitmasks, Submask Enumeration, Sprague-Grundy Theorem, BFS, Constructive Algorithms, Precompute, Trial and Error |
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.
| # |
Title |
Solution |
Time |
Space |
Difficulty |
Tag |
Note |
| A |
Wonderland Chase |
Python3 |
O(J + C) |
O(J + C) |
Easy |
|
Graph, BFS |
| B |
Goose, Goose, Ducks? |
*PyPy3 C++ |
O(N + M + S * (logM + logS)) |
O(N + S) |
Hard |
|
Logic-Based, Sorted List, Graph, BFS, SCC, Tarjan's Algorithm |
| C |
Slide Parade |
PyPy3 |
O(B * S + S^2) |
O(B * S) |
Medium |
|
BFS, Constructive Algorithms, Bipartite Matching, Hungarian Algorithm, Eulerian Path, Hierholzer's Algorithm |
| D |
Schrödinger and Pavlov |
PyPy3 |
O(N) |
O(N) |
Hard |
❤️ |
Graph, Probability, DP |
| E |
Triangles |
PyPy3 C++ |
O(N^2) |
O(N) |
Very Hard |
❤️ |
Geometry, Constructive Algorithms, Greedy |