Coder Social home page Coder Social logo

kamyu104 / googlecodejam-2019 Goto Github PK

View Code? Open in Web Editor NEW
43.0 4.0 15.0 585 KB

🏃 Python Solutions of All 27 Problems in GCJ 2019

License: MIT License

Python 93.65% C++ 6.35%
codejam-problems codejam2019 codejam codejam19 python algorithm googlecodejam code-jam programming-contests google-code-jam

googlecodejam-2019's Introduction

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).

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

googlecodejam-2019's People

Contributors

kamyu104 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

googlecodejam-2019's Issues

Space complexity

Hi,

I'm wondering why for the
https://github.com/kamyu104/GoogleCodeJam-2019/blob/master/Qualification%20Round/foregone-solution.py
and
https://github.com/kamyu104/GoogleCodeJam-2019/blob/master/Qualification%20Round/you-can-go-your-own-way.py

the space complexity is O(1)

In the first case we need to store the number N which is logN-digit number so we need a space of O(logN) don't we?

It would be O(1) if we were to read one digit, do the calculation and output it and then loop for the next.

In the second case we have the n-step path, so again we need the space of O(N) unless we do the similar stuff.

Or am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.