Coder Social home page Coder Social logo

kamyu104 / metahackercup-2022 Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 4.0 136 KB

๐Ÿƒ Python3 Solutions of All 30 Problems in MHC 2022

License: MIT License

Python 100.00%
algorithm algorithm-challenges competitive-programming hackercup programming-contests puzzle-solution contest-programming facebook-hacker-cup meta-hacker-cup

metahackercup-2022's Introduction

  • Python3 solutions of Meta Hacker Cup 2022. Solution begins with * means it will get TLE in the largest data set.
  • Total computation amount > 10^8, which is not friendly for Python3 to solve in 5 ~ 15 seconds. A 6-minute timer is set for uploading the result this year.
  • 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

# Title Solution Time Space Difficulty Tag Note
A Second Hands Python3 O(N) O(N) Easy Greedy
B1 Second Friend Python3 O(R * C) O(1) Easy Constructive Algorithms
B2 Second Second Friend Python3 O(R * C) O(R * C) Medium Constructive Algorithms, BFS
C1 Second Meaning Python3 O(N^2) O(N) Easy Constructive Algorithms
C2 Second Second Meaning Python3 O(NlogN) O(logN) Medium Constructive Algorithms
D Second Flight Python3 Python3 O(N + Q + M * min(sqrt(Q), N)) O(N + M + Q) Hard Graph, Memoization

Round 1

# Title Solution Time Space Difficulty Tag Note
A1 Consecutive Cuts - Chapter 1 Python3 O(N) O(1) Easy Constructive Algorithms, String
A2 Consecutive Cuts - Chapter 2 Python3 Python3 Python3 O(N) O(1) Medium Constructive Algorithms, String, KMP Algorithm, Z-Function, Rabin-Karp Algorithm, Rolling Hash
B1 Watering Well - Chapter 1 Python3 O(N + Q + min(N * Q, MAX_A_B_X_Y^2)) O(min(N + Q, MAX_A_B_X_Y)) Easy Math, Freq Table
B2 Watering Well - Chapter 2 Python3 O(N + Q) O(1) Easy Math
C Lemonade Life PyPy3 O(NlogN + V^2) O(N + V) Hard Geometry, Convex Hull, Monotone Chain Algorithm, Graph, Dijkstra's Algorithm

Round 2

# Title Solution Time Space Difficulty Tag Note
A1 Perfectly Balanced - Chapter 1 Python3 O(N + Q) O(N) Easy Prefix Sum
A2 Perfectly Balanced - Chapter 2 Python3 O((N + Q) * logN) O(N) Medium Hash, BIT, Fenwick Tree
B Balance Sheet Python3 O(NlogN + N * K) O(N * K) Medium Sort, Greedy, DP
C Balance Scale Python3 precompute: O(MAX_N * MAX_C)
runtime: O(N)
precompute: O(MAX_N * MAX_C)
runtime: O(1)
Easy Combinatorics, Probability
D1 Work-Life Balance - Chapter 1 Python3 O((N + M) * logN) O(N) Medium BIT, Fenwick Tree, Greedy
D2 Work-Life Balance - Chapter 2 Python3 O((N + M) * logN) O(N) Hard BIT, Fenwick Tree, Greedy

Round 3

# Title Solution Time Space Difficulty Tag Note
A Fourth Player Python3 O(NlogN) O(N) Medium Games, Greedy
B Third Trie Python3 O(N * M) O(T) Easy Trie, Combinatorics
C Second Mistake Python3 O(3 * L * (N + Q)) O(3 * L * N) Easy Rabin-Karp Algorithm, Hash Table
D1 First Time - Chapter 1 Python3 O(M + NlogN) O(N) Medium Unordered Set
D2 First Time - Chapter 2 Python3 O(M + NlogN) O(N) Hard Unordered Set, Segment Tree, Number Theory
E1 Zero Crossings - Chapter 1 Python3 Python3 O((N * M + Q) * log(N * M + Q)) O(N * M + Q) Hard Offline Solution, Geometry, Sort, Line Sweep, Treap, Sorted List, Binary Search, Tree, DFS, Hash
E2 Zero Crossings - Chapter 2 PyPy3 O((N * M) * log(N * M) + Q * log(N * M)) O((N * M) * log(N * M) Hard Online Solution, Geometry, Sort, Line Sweep, Persistent Treap, Binary Search, Tree, DFS, Hash

Final Round

You can relive the magic of the 2022 Hacker Cup World Finals by watching the Live Stream Recording of the announcement of winners.

# Title Solution Time Space Difficulty Tag Note
A ML Modeling PyPy3 O(MAX_X * MAX_Y * MAX_R * MIN_N + (MAX_X * MAX_Y)^2 + N) O(MAX_X * MAX_Y) Medium Geometry, Sampling
B Emerald Exhibiting PyPy3 O(P * logN) O(MAX_N) Medium Combinatorics, Number Theory
C Tile Transposing PyPy3 PyPy3 O(M * N * log(M * N)) O(M * N) Hard DFS, Persistent Union Find
D Alphabet Adventuring Python3 O((R^2 + log(N + Q)) * (N + Q) + Q * (R^2 + log(N + Q))* log(N + Q)) O((R^2 + log(N + Q)) * (N + Q)) Hard Tree Traversal, Tree Ancestors (Binary Lifting), Heavy-Light Decomposition, Path Compression
E Hazelnut Harvesting Python3 O(NlogN) O(NlogN) Hard Coordinate Compression, Segment Tree, Line Sweep, Mono Stack
F Cup Counterbalancing PyPy3 O(N * S) O(N) Very Hard Geometry, Sampling

metahackercup-2022'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

Watchers

 avatar  avatar  avatar  avatar

metahackercup-2022's Issues

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.