GoogleKickStart 2020 [](./LICENSE)

October 17, 2021 ยท View on GitHub

Python solutions of Google Kick Start 2020. 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). A problem was marked as Very Hard means that it was an unsolved one during the contest and may not be that difficult.

Round A

#TitleSolutionTimeSpaceDifficultyTagNote
AAllocationPythonO(N)O(MAX_A)EasyGreedy, Counting Sort
BPlatesPythonO(N * P * K)O(P)EasyDP, Prefix Sum
CWorkoutPythonO(Nlog(MAX_DIFF))O(1)EasyBinary Search, Greedy
DBundlingPythonO(N * L)O(T)MediumTrie, Greedy, DFS, Stack

Round B

#TitleSolutionTimeSpaceDifficultyTagNote
ABike TourPythonO(N)O(1)EasyArray
BBus RoutesPythonO(N)O(1)EasyGreedy
CRobot Path DecodingPythonO(N)O(N)EasyStack
DWandering RobotPython PythonO(W + H)O(W + H)HardBinomial Coefficients, Probability, Log Representation, Prefix Sum

Round C

#TitleSolutionTimeSpaceDifficultyTagNote
ACountdownPythonO(N)O(1)EasyArray
BStable WallPythonO(R * C)O(1)EasyTopological Sort, DFS
CPerfect SubarrayPyPyO(N * sqrt(N * MAX_A))O(N * MAX_A)MediumMath, Prefix Sum
DCandiesPythonO(N + QlogN)O(N)MediumBIT, Fenwick Tree

Round D

#TitleSolutionTimeSpaceDifficultyTagNote
ARecord BreakerPythonO(N)O(1)EasyArray
BAlien PianoPythonO(K)O(1)EasyGreedy
CBeauty of TreePythonO(N)O(N)MediumDFS, Math
DLocked DoorsPyPyO(NlogN + QlogN)O(N)HardCartesian Tree, Binary Lifting

Round E

#TitleSolutionTimeSpaceDifficultyTagNote
ALongest ArithmeticPythonO(N)O(1)EasyArray
BHigh BuildingsPythonO(N)O(N)EasyConstructive Algorithms
CToysPythonO(NlogN)O(N)MediumGreedy, Heap
DGolden StonePython PythonO((N * S + M * S + R * N) * log(N * S))O(N * S + M)HardDijkstra's Algorithm

Round F

#TitleSolutionTimeSpaceDifficultyTagNote
AATM QueuePythonO(NlogN)O(1)EasySort
BMetal HarvestPythonO(NlogN)O(1)EasySort
CPainters' DuelPythonO(2^(S^2))O(2^(S^2))MediumMemoization, Alpha Beta Pruning
DYeetzheePythonO(M * S)O(M * S)HardMath, Expected Value, Memoization, Greedy

Round G

#TitleSolutionTimeSpaceDifficultyTagNote
AKick_StartPythonO(N)O(1)EasyMath
BMaximum CoinsPython PythonO(N^2)O(1)EasyMatrix
CCombination LockPython PythonO(WlogW)O(1)EasyMath, Median, Prefix Sum
DMerge CardsPython PythonO(N)O(N)MediumMath, Expected Value, DP, Precompute, Prefix Sum

Round H

#TitleSolutionTimeSpaceDifficultyTagNote
ARetypePythonO(1)O(1)EasyMath
BBoring NumbersPythonO(logR)O(1)EasyMath
CRugbyPythonO(NlogN)O(N)MediumMath, Median
DFriendsPyPy PyPyO(A^3 + L^2 * (N + Q))O(A^2)MediumFloyd-Warshall Algorithm