https://github.com/glintonliao/competitive-programming
Selected algorithm templates and solutions
https://github.com/glintonliao/competitive-programming
algorithms competitive-programming cpp
Last synced: over 1 year ago
JSON representation
Selected algorithm templates and solutions
- Host: GitHub
- URL: https://github.com/glintonliao/competitive-programming
- Owner: GlintonLiao
- Created: 2022-10-16T17:17:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T17:02:43.000Z (over 3 years ago)
- Last Synced: 2025-01-25T00:20:00.319Z (over 1 year ago)
- Topics: algorithms, competitive-programming, cpp
- Language: C++
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Competitive Programming
Selected algorithm templates and solutions
```cpp
#include
#include
#include
using namespace std;
int main() {
return 0;
}
```
### Choosing Algorithms Based on Data Scale
1. `n ≤ 30`, DFS + Pruning,BitMask DP
2. `n ≤ 100` => `O(n^3)`, floyd,DP,Gaussian Elimination
3. `n ≤ 1000` => `O(n2)`, `O(n^2logn)`, DP, BinarySearch,Dijkstra-B, Prim-B, Bellman-Ford
4. `n ≤ 10000` => `O(n√n)`,Unrolled Linked List, Block Partition, Mo's Algorithm
5. `n ≤ 100000` => `O(nlogn)` => Sort, Segment Tree, Binary Indexed Tree, Set/Map, Heap, TopoSort, Dijkstra-H, Prim-H, Kruskal, SPFA, Convex Hull, BinarySearch, CDQ, Suffix array, Heavy Path Decomposition, LCT
6. `n ≤ 1000000` => `O(n)`, and low constant `O(nlogn)` => PriorityQueue, Hash, Two Pointers, Union Find, KMP, Aho–Corasick, or Sort、Binary Indexed Tree、Heap、Dijkstra、SPFA
7. `n ≤ 10000000` => `O(n)`, Two Pointers、KMP、Aho–Corasick、Sieve Prime
8. `n ≤ 10^9` => `O(√n)`,Sieve Prime
9. `n ≤ 10^18` => `O(logn)`,GCD, Binary Exponentiation, Decimal DP
10. `n ≤ 10^1000` => `O((logn)^2)`, High Precision
11. `n ≤ 10100000` => `O(logk×loglogk)`, k means bits, High Precision +/-、FFT/NTT