GoogleCodeJam-2019
GoogleCodeJam-2019 copied to clipboard
๐ Python Solutions of All 27 Problems in GCJ 2019
GoogleCodeJam 2019

Python solutions of Google Code Jam 2019. Solution begins with *
means it will get TLE in the largest data set (total computation amount > 10^8
, which is not friendly for Python to solve in 5 ~ 15 seconds).
- Code Jam 2018
- Qualification Round
- Round 1A
- Round 1B
- Round 1C
- Round 2
- Round 3
- World Finals
- Code Jam 2020
Qualification Round
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Foregone Solution | Python | O(logN) | O(1) | Easy | Math | |
B | You Can Go Your Own Way | Python | O(N) | O(1) | Easy | String | |
C | Cryptopangrams | Python | O(LlogN) | O(1) | Medium | Math | |
D | Dat Bae | Python Python | O(NlogB) | O(N) | Medium | Bit Manipulation, BFS |
Round 1A
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Pylons | Python | O(R * C) | O(1) | Medium | Constructive | |
B | Golf Gophers | Python Python | O(B * N + BlogM) | O(B) | Medium | Chinese Remainder Theorem | |
C | Alien Rhyme | Python | O(T) | O(T) | Easy | Trie |
Round 1B
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Manhattan Crepe Cart | Python | O(PlogP) | O(P) | Easy | Line Sweep | |
B | Draupnir | Python | O(1) | O(1) | Medium | Math | |
C | Fair Fight | Python PyPy | O(NlogN) | O(N) | Hard | Mono Stack, Binary Search, RMQ |
Round 1C
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Robot Programming Strategy | Python | O(A^2) | O(A) | Easy | Greedy | |
B | Power Arrangers | Python | O(1) | O(1) | Easy | Math | |
C | Bacterial Tactics | Python | O(R^2 * C^2 * (R + C)) | O(R^2 * C^2) | Medium | SpragueโGrundy Theorem |
Round 2
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | New Elements: Part 1 | Python | O(N^2 * log(max(C, J))) | O(N^2 * log(max(C, J))) | Easy | Math | |
B | Pottery Lottery | Python Python | O(PlogV) | O(V) | Medium | Math, Greedy | |
C | New Elements: Part 2 | Python | O(N^2 * log(max(C, J))) | O(log(max(C, J))) | Medium | Math, Continued Fraction | |
D | Contransmutation | Python | O(M) | O(M) | Hard | Graph, Topological Sort, DP |
Round 3
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Zillionim | Python Python | O(R^2) | O(R) | Easy | Sprague-Grundy Theorem, Nim | |
B | Pancake Pyramid | Python | O(S) | O(S) | Medium | Mono Stack | |
C | Datacenter Duplex | Python | O(R * C) | O(R * C) | Medium | Union Find | |
D | Napkin Folding | Python | O(N^2 * K^2) | O(N * K^2) | Very Hard | โค๏ธ | Geometry, Sliding Window, Binary Search, BFS, DFS |
World Finals
You can relive the magic of the 2019 Code Jam World Finals by watching the Live Stream Recording of the competition, problem explanations, interviews with Google and Code Jam engineers, and announcement of winners.
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
A | Board Meeting | Python | O(NlogM) | O(N) | Medium | Binary Search, Math | |
B | Sorting Permutation Unit | Python | O(K * N^2) | O(N) | Medium | Sort | |
C | Won't sum? Must now | Python | O(2^(D/2) * D) | O(D) | Hard | โค๏ธ | Backtracking, Arithmetic, Palindrome |
D | Juggle Struggle: Part 1 | PyPy | O(NlogN) on average | O(N) | Medium | Geometry, Recursion, Quick Select | |
E | Juggle Struggle: Part 2 | PyPy | O(NlogN) | O(N) | Hard | โค๏ธ | Geometry, Sort, Mono Stack, Convex Hull |
F | Go To Considered Helpful | C++ *PyPy | O(N^4) | O(N^2) | Medium | BFS, DP |