Skip to content

Latest commit

Β 

History

History
358 lines (349 loc) Β· 29.4 KB

README.md

File metadata and controls

358 lines (349 loc) Β· 29.4 KB

This was my practice run for ICPC. There are more than 250 accepted solutions listed here. I have also added tags for some of the problems.

  • At first try to come up with a solution by yourself.
  • If you can't then read some article on the associated tags and try again.
  • If you still can't then you proceed to the solution. Try to understand what is going on. Then try your own approach.

The CSES problems can be found here: https://cses.fi/problemset/list/ This set has some classic problems.

Milestones:

  • 25/11/2021: Solved all Introductory Problems
  • 30/11/2021: Solved all Tree Problems
  • 29/12/2021: Solved 100th Problem
  • 05/05/2022: Solved 150th Problem
  • 04/10/2022: Solved all Geometry Problems
  • 05/12/2022: Solved 200th Problem
  • 06/11/2023: Solved all Range Query Problems
  • 11/11/2023: Solved 250th Problem
  • 03/12/2023: Solved all Sorting and Searching Problems

Introductory Problems

Status Name Tags Link
βœ” Weird Algorithm Code
βœ” Missing Number Code
βœ” Repetitions Code
βœ” Increasing Array Code
βœ” Permutations Code
βœ” Number Spiral Code
βœ” Two Knights Code
βœ” Two Sets Code
βœ” Bit Strings Code
βœ” Trailing Zeros Code
βœ” Coin Piles Code
βœ” Palindrome Reorder Code
βœ” Gray Code Code
βœ” Tower of Hanoi Code
βœ” Creating Strings Code
βœ” Apple Division Code
βœ” Chessboard and Queens Code
βœ” Digit Queries Code
βœ” Grid Paths Code

Sorting and Searching

Status Name Tags Link
βœ” Distinct Numbers Code
βœ” Apartments Code
βœ” Ferris Wheel Code
βœ” Concert Tickets Code
βœ” Restaurant Customers Code
βœ” Movie Festival Code
βœ” Sum of Two Values Code
βœ” Maximum Subarray Sum Code
βœ” Stick Lengths Code
βœ” Missing Coin Sum Code
βœ” Collecting Numbers Code
βœ” Collecting Numbers II Code
βœ” Playlist Code
βœ” Towers Code
βœ” Traffic Lights Code
βœ” Josephus Problem I Code
βœ” Josephus Problem II OST Code
βœ” Nested Ranges Check Code
βœ” Nested Ranges Count Point Update Range Sum Code
βœ” Room Allocation Code
βœ” Factory Machines Code
βœ” Tasks and Deadlines Code
βœ” Reading Books Code
βœ” Sum of Three Values Code
βœ” Sum of Four Values Code
βœ” Nearest Smaller Values Code
βœ” Subarray Sums I Code
βœ” Subarray Sums II Code
βœ” Subarray Divisibility Code
βœ” Subarray Distinct Values Two pointers Sliding Window Code
βœ” Array Division Code
βœ” Sliding Median Code
βœ” Sliding Cost OST Point Update Range Sum Code
βœ” Movie Festival II Greedy Scheduling Binary Search Code
βœ” Maximum Subarray Sum II Code

Dynamic Programming

Status Name Tags Link
βœ” Dice Combinations Coin change DP Code
βœ” Minimizing Coins Coin change DP Code
βœ” Coin Combinations I Coin change DP Code
βœ” Coin Combinations II Coin change DP Code
βœ” Removing Digits Code
βœ” Grid Paths Code
βœ” Book Shop Code
βœ” Array Description Code
βœ” Counting Towers Code
βœ” Edit Distance Code
βœ” Rectangle Cutting Code
βœ” Money Sums Code
βœ” Removal Game Code
βœ” Two Sets II Knapsack DP Code
βœ” Increasing Subsequence LIS Code
βœ” Projects Code
Elevator Rides Code
βœ” Counting Tilings Broken Profile DP Bitmask Code
βœ” Counting Numbers Digit Dp Code

Graph Algorithms

Status Name Tags Link
βœ” Counting Rooms BFS Code
βœ” Labyrinth BFS Code
βœ” Building Roads BFS DFS Forest Counting Code
βœ” Message Route BFS Code
βœ” Building Teams Bicoloring DFS Code
βœ” Round Trip Cycle in undirected graph DFS Code
βœ” Monsters BFS Code
βœ” Shortest Routes I Single Source Shortest Path Dijkstra Code
βœ” Shortest Routes II All Pair Shortes Path Floyd Warshall Code
βœ” High Score Single Source Shortest Path Bellman Ford Code
βœ” Flight Discount Single Source Shortest Path Dijkstra Code
βœ” Cycle Finding Negative Cycle Bellman Ford Code
Flight Routes Code
βœ” Round Trip II DFS Cycle in directed graph Code
βœ” Course Schedule Topological Sort Code
βœ” Longest Flight Route Topological Sort DP Code
βœ” Game Routes Topological Sort DP Code
βœ” Investigation Dijkstra Code
βœ” Planets Queries I Binary Lifting Code
Planets Queries II Code
βœ” Planets Cycles DFS Code
βœ” Road Reparation Minimum Spanning Tree Kruskal Code
βœ” Road Construction DSU Code
βœ” Flight Routes Check Strongly Connected Components Code
βœ” Planets and Kingdoms Strongly Connected Components Code
βœ” Giant Pizza 2-SAT Code
βœ” Coin Collector Condensation Graph Topological Sort DP Code
βœ” Mail Delivery Euler Tour - Undirected Code
De Bruijn Sequence Code
βœ” Teleporters Path Euler Path - Directed Code
βœ” Hamiltonian Flights Hamiltonian Path Bitmask DP Code
βœ” Knight's Tour Hamiltonian Path Heuristics Code
βœ” Download Speed Max Flow Min Cut Push Relabel Dinic Code
βœ” Police Chase Max Flow Min Cut Push Relabel Code
βœ” School Dance Max Flow``Bipartite Matching Hopkroft Carp Code
βœ” Distinct Routes Max Flow Dinic Path reconstruction Code

Range Queries

Status Name Tags Link
βœ” Static Range Sum Queries Code
βœ” Static Range Minimum Queries Code
βœ” Dynamic Range Sum Queries Code
βœ” Dynamic Range Minimum Queries Code
βœ” Range Xor Queries Code
βœ” Range Update Queries Code
βœ” Forest Queries Code
βœ” Hotel Queries Code
βœ” List Removals Code
βœ” Salary Queries Code
βœ” Prefix Sum Queries Code
βœ” Pizzeria Queries Code
βœ” Subarray Sum Queries Code
βœ” Distinct Values Queries Code
βœ” Increasing Array Queries Segment tree Tree walking Code
βœ” Forest Queries II Code
βœ” Range Updates and Sums Code
βœ” Polynomial Queries Lazy Segment Tree Code
βœ” Range Queries and Copies Persistent Segment Tree Code

Tree Algorithms

Status Name Tags Link
βœ” Subordinates Subtree DP Code
βœ” Tree Matching Tree DP Code
βœ” Tree Diameter Tree Diameter Code
βœ” Tree Distances I Tree Diameter Code
βœ” Tree Distances II Tree Rerooting DP Code
βœ” Company Queries I Binary Lifting Code
βœ” Company Queries II LCA Code
βœ” Distance Queries LCA Code
βœ” Counting Paths HLD Code
βœ” Subtree Queries HLD Code
βœ” Path Queries HLD Code
βœ” Path Queries II HLD Code
βœ” Distinct Colors MO on Tree / Sack Small to Large Code Code
βœ” Finding a Centroid Centroid Code
βœ” Fixed-Length Paths I Centroid Decomposition Code
βœ” Fixed-Length Paths II Centroid Decomposition Code

Mathematics

Status Name Tags Link
βœ” Josephus Queries Code
βœ” Exponentiation Code
βœ” Exponentiation II Code
βœ” Counting Divisors Code
βœ” Common Divisors Code
βœ” Sum of Divisors Code
βœ” Divisor Analysis Code
βœ” Prime Multiples Code
βœ” Counting Coprime Pairs Code
βœ” Binomial Coefficients Code
βœ” Creating Strings II Code
βœ” Distributing Apples Code
βœ” Christmas Party Code
βœ” Bracket Sequences I Code
βœ” Bracket Sequences II Code
βœ” Counting Necklaces Code
βœ” Counting Grids Code
βœ” Fibonacci Numbers Code
βœ” Throwing Dice Code
βœ” Graph Paths I Code
βœ” Graph Paths II Code
βœ” Dice Probability Code
Moving Robots Code
βœ” Candy Lottery Expected Value Code
Inversion Probability Code
βœ” Stick Game Code
βœ” Nim Game I Code
βœ” Nim Game II Code
βœ” Stair Game Code
βœ” Grundy's Game Code
βœ” Another Game Code

String Algorithms

Status Name Tags Link
βœ” Word Combinations Trie DP Code
βœ” String Matching Suffix array / Hashing Code
βœ” Finding Borders Z function Prefix function / Hashing Code
βœ” Finding Periods Z function Prefix function / Hashing Code
βœ” Minimal Rotation Suffix Automata Code
βœ” Longest Palindrome Manacher Code
Required Substring Code
βœ” Palindrome Queries Range Sum Hashing Code
βœ” Finding Patterns Code
βœ” Counting Patterns Code
βœ” Pattern Positions Code
βœ” Distinct Substrings Code
βœ” Repeating Substring Hashing Binary Search Code
βœ” String Functions Code
βœ” Substring Order I Code
βœ” Substring Order II Code
βœ” Substring Distribution Suffix Array Longest Common Prefix Code

Geometry

Status Name Tags Link
βœ” Point Location Test Code
βœ” Line Segment Intersection Code
βœ” Polygon Area Code
βœ” Point in Polygon Code
βœ” Polygon Lattice Points Code
βœ” Minimum Euclidean Distance Code
βœ” Convex Hull Code

Advanced Techniques

Status Name Tags Link
βœ” Meet in the Middle Code
βœ” Hamming Distance Code
βœ” Beautiful Subgrids Bitset Code
βœ” Reachable Nodes Code
βœ” Reachability Queries Code
βœ” Cut and Paste Implicit Treap Code
βœ” Substring Reversals Implicit Treap Code
βœ” Reversals and Sums Implicit Treap Code
βœ” Necessary Roads Bridges Code
βœ” Necessary Cities Articulation Points Code
Eulerian Subgraphs Code
βœ” Monster Game I DP Convex Hull Optimization Code
βœ” Monster Game II DP Convex Hull Optimization Code
βœ” Subarray Squares DP Convex Hull Optimization Code
Houses and Schools Code
βœ” Knuth Division DP Knuth Optimization Code
βœ” Apples and Bananas FFT Code
βœ” One Bit Positions FFT Code
βœ” Signal Processing FFT Code
βœ” New Roads Queries HLD Code
βœ” Dynamic Connectivity Dynamic DSU Code
βœ” Parcel Delivery Max Flow Min Cost Fixed flow Code
βœ” Task Assignment Max Flow Min Cost Code
βœ” Distinct Routes II Max Flow Min Cost Path reconstruction Code

Additional Problems

Status Name Tags Link
βœ” Shortest Subsequence Code
βœ” Counting Bits Code
βœ” Swap Game Code
βœ” PrΓΌfer Code PrΓΌfer Code Code
βœ” Acyclic Graph Edges Code
βœ” Strongly Connected Edges Bridge Code
Even Outdegree Edges Code
βœ” Multiplication Table Binary Search Harmonic Progression Code
βœ” Advertisement Segment Tree Code
βœ” Special Substrings Constructive Hashing Code
Permutation Inversions Code
βœ” Maximum Xor Subarray Trie Divide and Conquer Code
βœ” Movie Festival Queries Greedy Scheduling RMQ Binary Lifting Code
βœ” Chess Tournament Greedy Code
βœ” Tree Traversals Code
βœ” Network Renovation Euler Tour Code
βœ” Graph Girth BFS Tree Code
βœ” Intersection Points Range Query with Sweep Line Code
βœ” Inverse Inversions Code
Monotone Subsequences Code
String Reorder Code
Stack Weights Code
Pyramid Array Code
βœ” Increasing Subsequence II Code
βœ” String Removals DP Cumulative sum Code
βœ” Bit Inversions Code
βœ” Xor Pyramid Code
βœ” Writing Numbers Code
βœ” String Transform Inverse Burrows Wheeler Transform Code
Letter Pair Move Game Code
βœ” Maximum Building I Segment Tree Code
Sorting Methods Code
βœ” Cyclic Array Binary Search Greedy Code
List of Sums Code
Increasing Array II Code
Food Division Code
βœ” Bit Problem SOS DP Code
Swap Round Sorting Code
Binary Subsequences Code
βœ” Tree Isomorphism I Tree Isomorphism rooted Code
βœ” Counting Sequences Inclusion Exclusion Principle Code
βœ” Critical Cities Dominator Tree Code
βœ” School Excursion Knapsack DP Bitset Code
Coin Grid Code
Robot Path Code
Programmers and Artists Code
Course Schedule II Code
Removing Digits II Code
Coin Arrangement Code
Counting Bishops Code
βœ” Grid Puzzle I Max Flow Min Cut Code
βœ” Grid Puzzle II Max Flow Max Cost Code
Empty String Code
βœ” Grid Paths DP Inclusion Exclusion Principle Code
βœ” Bit Substrings FFT Code
βœ” Reversal Sorting Implicit Treap Code
Counting Reorders Code
Book Shop II Code
βœ” Network Breakdown DSU with rollback Code
Visiting Cities Code
Missing Coin Sum Queries Code
βœ” Number Grid Constructive Code
Maximum Building II Code
Filling Trominos Code
βœ” Stick Divisions Huffman Coding greedy Code
βœ” Coding Company Open and Close Interval DP Code
Flight Route Requests Code
Two Stacks Sorting Code
βœ” Tree Isomorphism II Tree Isomorphism unrooted Code
βœ” Forbidden Cities Block Cut Tree Code
βœ” Area of Rectangles Range Query and Update with Sweep Line Code
Grid Completion Code
Creating Offices Code
βœ” Permutations II Connected Component DP Code
Functional Graph Distribution Code
New Flight Routes Code
Grid Path Construction Code