Plan
📚 Codeforces Prep Plan
Why CF ≠ LeetCode
| LeetCode | Codeforces |
|---|---|
| Pattern-matching | Problem-solving from first principles |
| One known technique per problem | Combinatorial thinking |
| Interview-centric | Competition-centric |
| Math-light | Math-heavy (modular arithmetic, combinatorics, number theory) |
| Constraints are hints | Constraints are traps |
| OOP/real-world flavored | Pure algorithmic |
The Roadmap
Phase 1: Foundation (Rating 800–1200)
Focus: Speed, implementation, math basics, brute force
Problem types: - Div 2 A: Always solve in ≤10 min. Implementation, math, simulation - Div 2 B: Greedy, two-pointer, binary search on answer, simple constructive
CORE PATTERNS TO MASTER:
- Modular arithmetic (a + b) % MOD, modPow, modInv
- Greedy proofs (exchange argument, sorting by key)
- Binary search on answer (a.k.a. "binary search the result")
- Prefix sums / difference arrays
- Frequency counting (maps/arrays)
- Simple constructive (build array matching constraints)
- Parity / modulo tricks
Key skill for Phase 1: Reading comprehension + brute force is too slow → realize when to binary search / greedy.
Phase 2: Intermediate (Rating 1200–1500)
Focus: Graph traversal, DP, number theory, binary search mastery
Problem types: - Div 2 C: Requires insight, combinatorial reasoning, DFS/BFS, basic DP - Div 2 B/C: 2-pointer variants, math with constraints
CORE PATTERNS TO MASTER: - Basic DFS/BFS on grids and trees - Knapsack/coin-change style DP (CF DP is rarely LeetCode DP) - DFS on DP (dp[node] = combine children) - Number theory: gcd/lcm, prime factorization, sieve, divisors - Binary search on answer for "minimize maximum" problems - Combinatorics: nCr, nPr, factorial precomputation, modular inverses - Coordinate compression + BIT/Fenwick - Graph building from problem statements (not given as explicit edges)
Phase 3: Advanced (Rating 1500–1800)
Focus: Harder CF problems, segment trees, combinatorics, harder DP
Problem types: - Div 2 D: Segment trees, advanced DP, combinatorics, game theory - Div 2 C/D: Complex constructive, math heavy, multi-step reasoning
CORE PATTERNS TO MASTER: - Segment Tree / Fenwick Tree: range queries, point updates - DP with data structures: dp[i] = max(dp[j] + ...) optimized with segment tree - Matrix exponentiation for linear recurrences - DFS Order + Euler Tour: flatten tree to array for segment tree - Sparse Table for RMQ - DSU with rollbacks - Game theory: Grundy, Nim, impartial games - Probability / expected value DP
Phase 4: Expert (Rating 1800–2200)
Focus: Div 1, problem rating 2000+
- Heavy data structures (Lazy propagation, Link-Cut, HLD)
- Flow / matching
- Polynomials / FFT
- Advanced combinatorics
- SQRT decomposition / Mo's algorithm
Weekly Schedule
| Day | Focus | Problem Count | Source |
|---|---|---|---|
| Mon | Implementation + Math (A/B) | 3 | CF Problemset (800–1200) |
| Tue | Greedy + Binary Search | 3 | CF Problemset (1200–1400) |
| Wed | Graphs + Trees | 3 | CF Problemset (1200–1500) |
| Thu | DP | 3 | CF Problemset (1300–1600) |
| Fri | Number Theory + Combinatorics | 3 | CF Problemset (1300–1500) |
| Sat | Mock Contest (Virtual) | 1 contest | Any recent Div 2 |
| Sun | Review + Weakness Deep Dive | 3 | Target weak tag |
Problem Selection Strategy
Use CF Problemset with filter: 1. Sort by solved count (most → least) for tag X 2. Start with 800–1100 for new topics 3. Move to 1200–1400 once comfortable 4. Never spend >45 min staring — look at editorial, learn, move on
Note down after each problem: - What was the key insight? - What math trick was involved? - How would I have derived it faster?