Competitive Programming: From Zero to Jiangly
4440 words
22 minutes
Competitive Programming: From Zero to Jiangly
How to follow the checklist
- Start at your first weak stage. Familiarity with a name or a copied template does not mean you can solve an unfamiliar application.
- Each topic has one home. Later stages assume earlier material and introduce new techniques rather than repeat the syllabus.
- The placement is a study plan, not an official rating syllabus. Contestant ratings are not prerequisites for learning an algorithm, and problem ratings do not predict your rating change.
- The late specialist topics are optional branches. You do not need every rare algorithm to become a grandmaster.
- For each topic: derive it, prove its assumptions, implement it, verify it against a slow oracle, and recognize a disguised application.
- No finite catalog guarantees elite performance. The final stages emphasize invention and contest judgment alongside technical breadth.
Milestones from zero to the world-class end
| Stage | Transition | Milestone | Suggested practice window |
|---|---|---|---|
| 0 | No programming -> independent programmer | Unrated | Introductory tasks |
| 1 | Starting programmer -> confident newbie | Below 1200 | 800-1100 |
| 2 | Newbie -> pupil | 1200-1399 | 1000-1400 |
| 3 | Pupil -> specialist | 1400-1599 | 1200-1700 |
| 4 | Specialist -> expert | 1600-1899 | 1500-2000 |
| 5 | Expert -> candidate master | 1900-2099 | 1800-2200 |
| 6 | Candidate master -> master | 2100-2299 | 2000-2400 |
| 7 | Master -> international master | 2300-2399 | 2200-2600 |
| 8 | International master -> grandmaster | 2400-2599 | 2300-2800 |
| 9 | Grandmaster -> international grandmaster | 2600-2999 | 2500-3100 |
| 10 | International grandmaster -> legendary grandmaster | 3000+ | 2800-3400 |
| 11 | Legendary grandmaster -> consistent elite solver | Training target: 3300-3600 | 3000-3600 |
| 12 | Elite solver -> Jiangly/tourist-level training | World-class target: 3600-4000+ | Hardest available sets |
- Stages 11-12 are training bands, not additional standard Codeforces titles.
- Move by evidence, not by calendar. Use the exit gate in each section to choose your next work; no number of weeks or solved tasks guarantees a rank.
Stage 0 - No programming to independent programmer
C++ language and tools
- Program structure: headers,
main, statements, blocks, compilation, and execution. - Input/output: tokens,
getline, whitespace, end-of-file, and exact output formatting. - Integer types: signed ranges,
int,long long, literal suffixes, and conversions. - Floating-point types:
double,long double, rounding error, and printing precision. - Expressions: precedence, comparisons, logical operators, and short-circuit evaluation.
- Control flow: conditions, loops,
break,continue, and nested iteration. - Functions: parameters, return values, scope, overloads, and avoiding unnecessary copies.
- References and pointers: aliasing,
const, null pointers, and object lifetime. - Arrays and vectors: indexing, resizing, contiguous storage, and two-dimensional allocation.
- Strings and characters: character codes, substrings, concatenation, and classification.
- Records:
struct,pair,tuple, and structured bindings. - Iterators: half-open ranges, range-based loops, and invalidation after container changes.
- Lambdas: captures, comparators, and local helper functions.
- Recursion mechanics: call frames, base cases, progress, and recursion-depth limits.
Correctness before speed
- Complexity notation: worst-case time, extra memory, and logarithmic through exponential growth.
- Constraint reading: maximum dimensions, total input limits, and permitted value ranges.
- Overflow prevention: promote before multiplication, bound sums, and use
__int128where necessary. - Undefined behavior: invalid access, uninitialized variables, signed overflow, and invalid shifts.
- Compiler warnings: fix meaningful diagnostics instead of hiding them.
- Debugger and sanitizers: distinguish a broken assumption from a memory error.
- Manual tracing: explain each state change on a tiny input.
- Boundary testing: minimum sizes, duplicates, zero, negatives when allowed, and empty structures.
- Judge verdicts: distinguish compilation error, wrong answer, runtime error, and time/memory limits.
- Contest rules: separate practice assistance from permitted live-contest behavior.
Practice and exit gate
- Practice: introductory CSES arithmetic, input/output, and simulation exercises.
- Deliverable: a working local compile/run/debug setup you can use independently.
- Ready for Stage 1: write a small program from a specification and explain the cause of a failed test.
Stage 1 - Starting programmer to confident newbie
Elementary mathematics
- Integer division: floors, ceilings, quotient/remainder identities, and signed-division pitfalls.
- Divisibility: parity, multiples, and remainder classes.
- Euclidean gcd and lcm: including divide-before-multiply arithmetic.
- Trial primality testing: the square-root bound and why 1 is not prime.
- Divisor enumeration: paired divisors, perfect squares, and sorted output.
- Trial factorization: prime exponents and reconstructing the original integer.
- Sieve of Eratosthenes: composite marking over a bounded domain.
- Numeral systems: decimal/binary conversion, digit extraction, and positional values.
- Bit operations: AND, OR, XOR, complement, shifts, bit tests, and population count.
- Basic counting rules: sum/product rules and ordered versus unordered selections.
- Discrete geometry: grid coordinates, Manhattan distance, chessboard parity, and offsets.
Basic algorithmic work
- Direct simulation: encode exactly the state and operation order in the statement.
- Frequency tables: dense counters versus sparse key counts.
- Sorting: strict weak ordering, stable sorting, and lexicographic comparisons.
- Sets and multisets: membership, multiplicity, predecessor, and successor.
- Maps and hash maps: key/value state, accidental insertion, and expected versus guaranteed lookup time.
- Stacks, queues, and deques: select the container from its access pattern.
- Priority queues: repeatedly obtain a current minimum or maximum.
- Prefix sums: one-dimensional and rectangular two-dimensional static sums.
- Difference arrays: batch range additions and reconstruct the final array.
- Run-length encoding: maximal consecutive groups and boundary handling.
- Complete enumeration: all single, pair, or triple choices within the constraints.
- Permutation generation:
next_permutationand repeated values. - Subset enumeration: integer masks for all subsets of a small set.
- Backtracking: choose, recurse, undo, and justify every pruning condition.
- Direct string checks: subsequences, naive pattern search, and naive palindrome tests.
Practice and exit gate
- Practice window: mainly 800-1100, increasing difficulty when independent solves become reliable.
- Training focus: translate a sentence into an exact condition before coding loops.
- Ready to aim for pupil: unfamiliar easy tasks no longer need copied solutions, and you can estimate the work of a brute force.
Stage 2 - Newbie to pupil (1200)
Reasoning and construction
- Greedy exchange proofs: replace part of an optimum with your choice without making it worse.
- Stays-ahead arguments: compare your construction’s progress with any competing construction.
- Extremal choices: fix a smallest/largest object and derive what it forces.
- Derived sorting keys: compare adjacent decisions to justify their order.
- Interval scheduling: maximize compatible intervals with explicit endpoint conventions.
- Resource-budget greedy: spend limited resources only under a valid optimality argument.
- Constructive invariants: preserve a property while building an output or operation list.
- Necessary and sufficient conditions: prove both impossibility and construction validity.
- Complement counting: count excluded objects when the desired family is awkward.
- Contribution counting: count how often an element, pair, or boundary participates.
- Telescoping: cancel terms rather than evaluate the same work repeatedly.
- Symmetry reduction: identify equivalent cases before creating branches.
Searching and scanning
- Binary search on sorted values: first/last occurrence and insertion positions.
- Binary search on the answer: monotone feasibility, endpoint invariants, and termination.
- Opposing two pointers: use order to eliminate whole families of pairs.
- Same-direction two pointers: prove neither boundary needs to move backward.
- Sliding windows: maintain counts or an aggregate under endpoint additions/removals.
- Monotonic stacks: nearest greater/smaller boundaries and extremum contributions.
- Monotonic queues: fixed-window extrema with amortized linear work.
- Prefix/suffix summaries: combine independent information around a split.
- Coordinate compression: preserve order while compacting sparse values.
- Sweep-line events: additions, removals, queries, and equal-coordinate tie order.
- Interval merging: covered length, connected pieces, and touching endpoints.
- Prefix XOR: cancellation and parity transformations for static ranges.
Practice and exit gate
- Practice window: 1000-1400, with untagged tasks between topic-specific sessions.
- Training focus: write the missing proof instead of trusting a plausible pattern.
- Pupil readiness: finish straightforward contest tasks reliably and find small counterexamples to incorrect greedy ideas.
Stage 3 - Pupil to specialist (1400)
Dynamic programming foundations
- State design: retain exactly the history that can affect future choices.
- Memoization versus tabulation: dependencies, evaluation order, and repeated states.
- State meanings: distinguish reachability, counting, minimum cost, and maximum value.
- One-dimensional sequence DP: prefix states versus states ending at a position.
- Grid DP: obstacles, legal movement, and boundary initialization.
- 0/1 knapsack: descending capacity updates and single-use items.
- Unbounded knapsack: transitions that permit repeated use.
- Value-indexed knapsack: exchange a large capacity for a smaller total-value dimension.
- Coin-counting order: combinations versus ordered sequences through loop order.
- Subset-sum bitsets: shift-and-OR reachability and machine-word parallelism.
- Longest increasing subsequence: quadratic reasoning, tails optimization, strictness, and reconstruction.
- LCS and edit distance: two-prefix states and recovering an optimal alignment.
- Witness reconstruction: parent choices and tie handling beyond the final numeric answer.
- Rolling memory: remove a dimension only after checking all dependencies.
Graphs and trees
- Graph modeling: vertices, directed/undirected edges, weights, and implicit state spaces.
- Graph storage: adjacency lists, edge ids, and handling parallel edges.
- BFS: unweighted shortest distances and parent recovery.
- Multi-source BFS: several initial states in one distance wavefront.
- DFS: entry/exit state and an iterative alternative for deep inputs.
- Connected components: flood fill and grouping mutually reachable states.
- Bipartiteness: two-color constraints and odd-cycle witnesses.
- Cycle detection: undirected parent edges versus directed recursion-stack state.
- Topological sorting: dependency order, Kahn’s algorithm, and cycle detection.
- DAG DP: evaluate graph transitions in a valid order.
- Disjoint-set union: union by size, path compression, and insertion-only connectivity.
- Rooted-tree basics: parents, children, depths, subtree sizes, preorder, and postorder.
- Euler subtree flattening: convert every subtree into a half-open interval.
Range-query foundations
- Fenwick trees: point changes, prefix aggregation, and interval answers by subtraction.
- Segment-tree monoids: associative merge, identity element, and node summaries.
- Point-update segment trees: sum/min/max queries and recursive versus iterative layouts.
Practice and exit gate
- Practice window: 1200-1700; mix graph, DP, and greedy problems without visible tags.
- Training focus: define a state or graph vertex in one precise sentence.
- Specialist readiness: select the model independently, reconstruct required outputs, and estimate memory before allocation.
Stage 4 - Specialist to expert (1600)
Paths and graph optimization
- 0-1 BFS: deque ordering for edges of weight zero or one.
- Dijkstra: nonnegative weights, stale heap entries, and safe distance types.
- Expanded-state shortest paths: encode a small mode, resource count, parity, or coupon state.
- Floyd-Warshall: all-pairs paths and the intermediate-vertex invariant.
- Minimum spanning trees: Kruskal, Prim, cut/cycle properties, and identifying the correct objective.
- Functional graphs: tails, cycles, component structure, and distance to a cycle.
- Tree diameter and centers: farthest endpoints and distance geometry on a tree.
Stronger DP and offline work
- Interval DP: choose a split or the last operation in a contiguous region.
- Bitmask DP: visited-set, assignment, and Hamiltonian subset states.
- Submask iteration: enumerate all submasks and account for the total work.
- Meet in the middle: split exponential choices and combine half-state summaries.
- Bounded knapsack: binary grouping and multiplicity-aware transitions.
- Restricted-path counting: store only the small history needed for future legality.
- Offline query ordering: sort requests so the maintained structure only moves forward.
- Next/previous occurrence reductions: turn distinctness or repetition into positional conditions.
Strings, static queries, and arithmetic
- Prefix function and KMP: borders, failure transitions, and linear-time matching.
- Z-function: prefix matches, concatenation boundaries, and repetition tests.
- Manacher: odd/even palindrome radii in linear time.
- Tries: prefix navigation, binary tries, and maximizing XOR against an inserted set.
- Polynomial rolling hashes: substring equality and explicit collision-risk reasoning.
- Binary lifting: ancestor jumps, kth ancestors, and repeated functional transitions.
- Lowest common ancestor: lifting queries and tree-path length identities.
- Sparse tables: static idempotent queries.
- Disjoint sparse tables: constant-time queries for general associative operations.
- Binary exponentiation: repeated squaring for large powers.
- Modular inverses: prime-modulus exponentiation and the invertibility requirement.
- Factorials and inverse factorials: repeated binomial queries under a suitable prime modulus.
- Elementary plane geometry: vectors, dot/cross products, orientation, squared distance, and signed area.
- Segment intersection: contact, collinearity, and exact integer predicates.
Practice and exit gate
- Practice window: 1500-2000, including complete virtual contests rather than only favorite topics.
- Training focus: identify where algorithm assumptions fail before they become wrong answers.
- Expert readiness: independently solve mixed tasks and justify why the chosen method fits their constraints.
Stage 5 - Expert to candidate master (1900)
Internal graph and tree structure
- Strongly connected components: Kosaraju/Tarjan and the condensation DAG.
- 2-SAT: implication graphs, contradictions, and recovering an assignment.
- Bridges and articulation points: low-link values and DFS-root exceptions.
- Biconnected components: vertex blocks, bridge forests, and block-cut trees.
- Bellman-Ford: negative edges, reachable negative cycles, and witness extraction.
- Difference constraints: turn inequalities into graph edges and test consistency.
- Rerooting DP: transfer information across a root edge without rebuilding the entire answer.
- Tree path differences: accumulate endpoint/LCA markers in postorder.
- Small-to-large merging: charge each element move to growth of its containing collection.
- Unicyclic decomposition: separate the unique cycle from its attached trees.
Mutable queries and mathematical tools
- Lazy propagation: compose update tags in the correct chronological order.
- Affine range updates: combine multiplication/addition and update aggregates consistently.
- Segment-tree descent: kth item, first feasible position, and first prefix crossing a threshold.
- Sqrt decomposition: balance full-block work against boundary processing.
- Static Mo’s algorithm: offline interval ordering with reversible endpoint changes.
- Ordered disjoint intervals: maintain runs only when the operation/complexity model supports it.
- Offline two-dimensional dominance: sort one coordinate and query another.
- Digit DP: tight bounds, leading zeroes, and the empty-number convention.
- Tree knapsack: child-budget merging with a bound on total transition work.
- Expectation DP: first-step equations, absorbing states, and self-loop rearrangement.
- Probability DP: conditional transitions, normalization, and numerical stability.
- Combinatorial identities: Pascal, Vandermonde, hockey-stick, and double counting.
- Inclusion-exclusion: overlapping forbidden events and subset-sign conventions.
- Extended Euclid: Bezout coefficients and inverses under a non-prime modulus.
- Linear Diophantine equations: parameterized solutions and bounded variables.
- Chinese remainder theorem: coprime systems and compatible non-coprime congruences.
- Matrix exponentiation: encode a finite linear transition in a consistent state order.
- Convex hull construction: monotone chain, duplicates, and collinear boundary policy.
- Coordinate transforms: simplify distance or ordering by rotating, shearing, or changing variables.
Practice and exit gate
- Practice window: 1800-2200, with deliberate work on observations rather than template collection.
- Training focus: combine two established tools and prove the interface between them.
- Candidate-master readiness: independently upsolve difficult misses and stop repeating the same proof or implementation mistakes.
Stage 6 - Candidate master to master (2100)
Tree decomposition and richer structures
- Heavy-light decomposition: logarithmically many path intervals and direction-aware aggregation.
- Centroid decomposition: balanced components and distance-to-centroid summaries.
- DSU on tree: retain a heavy child’s state while processing light subtrees.
- Segment-tree merging: combine sparse distributions with a node-allocation complexity argument.
- Persistent segment trees: path copying, version roots, and kth queries by prefix-version subtraction.
- Implicit segment trees: allocate only visited regions of a huge coordinate domain.
- Treaps: randomized priorities, split/merge, explicit keys, and implicit sequences.
- Order-statistic trees: rank/select and GNU-extension versus portable implementation choices.
- Sparse two-dimensional Fenwick trees: coordinate preparation inside each relevant node.
Optimizing a recurrence
- Divide-and-conquer DP optimization: monotone best split positions and their proof.
- Knuth optimization: interval recurrences, quadrangle inequalities, and the stronger split bounds required.
- Convex hull trick: line envelopes, monotone insertion/query conditions, and equal slopes.
- Li Chao trees: arbitrary insertion order over a bounded query domain.
- Sum-over-subsets DP: aggregation over subset/superset lattices.
- Profile DP: encode a bounded-width frontier instead of the entire processed region.
- Word-parallel DP: replace many boolean transitions with whole-word operations.
- Cost-to-decision transformations: parameterize a global objective into additive or feasible transitions.
Matching, flow, games, and interaction
- Bipartite matching: augmenting paths and Hopcroft-Karp layering.
- Konig’s theorem: recover a minimum vertex cover or maximum independent set from a matching.
- Maximum flow: residual edges, reverse capacities, Dinic layering, and integral solutions.
- Minimum-cut modeling: separate cut penalties from hard constraints.
- Flow extraction: reconstruct paths, matchings, and assignments from the residual network.
- Sprague-Grundy theory: mex values and xor composition of impartial normal-play games.
- Nim variants: derive the invariant instead of treating every subtraction game as ordinary Nim.
- Interactive protocol basics: flushing, invalid replies, termination, and query-format contracts.
- Query-budget proofs: count worst-case calls, including initialization and final confirmation.
Practice and exit gate
- Practice window: 2000-2400, including Div. 2 endings and accessible Div. 1 tasks.
- Training focus: prove the convexity, monotonicity, or conservation law behind an optimization.
- Master readiness: implement a nontrivial original reduction under contest time with a valid complexity argument and witness.
Stage 7 - Master to international master (2300)
Offline time and graph optimization
- Rollback DSU: snapshots and reversible unions without path compression.
- Segment tree over time: distribute lifetimes across recursion intervals for offline deletions.
- Parallel binary search: batch independent answer searches by shared processing order.
- Virtual trees: close a small query set under LCAs and compress its connecting topology.
- Eulerian trails: degree conditions, edge ids, Hierholzer traversal, and disconnected edge sets.
- Minimum-cost flow: residual costs, potentials, and reduced-cost invariants.
- Lower-bound circulation: balance demands with a super-source and super-sink.
- Johnson reweighting: use potentials for repeated nonnegative shortest-path computations.
- Hungarian algorithm: dense weighted bipartite assignment and dual labels.
- K-shortest path variants: distinguish walks from simple paths before choosing a method.
String structure and exact algebra
- Aho-Corasick: transitions, failure links, and occurrence aggregation on the failure tree.
- Suffix arrays: doubling construction, ranks, and adjacent LCP values.
- Suffix-array applications: distinct/common substrings and LCP interval queries.
- Suffix automata: end-position classes, clones, occurrence propagation, and substring statistics.
- Minimal rotation and Lyndon factorization: Booth/Duval-style lexicographic structure.
- Automaton DP: combine a matching state with counting or forbidden-pattern constraints.
- Linear sieve: smallest prime factors and multiplicative-function preprocessing.
- Euler phi and Mobius functions: coprimality, divisor inversion, and multiplicativity.
- Floor-division grouping: process intervals where floor(n/i) stays constant.
- Miller-Rabin: deterministic witness sets for a specified integer-width range.
- Pollard rho: randomized factor splitting and retry policies.
- Discrete logarithms: baby-step giant-step and non-coprime preconditions.
- Gaussian elimination: rank, inconsistency, free variables, and modular versus real arithmetic.
- XOR linear bases: independence over GF(2), attainable vectors, and maximum xor.
- FFT and NTT: convolution, zero padding, roots of unity, normalization, and transform-size limits.
- Walsh-Hadamard transforms: XOR/AND/OR convolution and each butterfly’s algebra.
- Burnside’s lemma: count orbits through fixed points under the intended group action.
Practice and exit gate
- Practice window: 2200-2600, especially tasks that hide the familiar structure behind a new story.
- Training focus: distinguish knowing how to call a tool from discovering its reduction.
- International-master readiness: finish combined-technique solutions consistently and explain why plausible alternatives are invalid.
Stage 8 - International master to grandmaster (2400)
Advanced queries and DP
- Wavelet trees/matrices: range order statistics and value-frequency queries.
- Segment tree beats: strict second extrema as certificates for bulk chmin/chmax updates.
- Partial persistence: historical-state queries when updates affect only the newest version.
- Mo with modifications: maintain reversible changes in both interval and time coordinates.
- Hilbert ordering: improve query locality without confusing a heuristic speedup with correctness.
- CDQ divide and conquer: enforce a dependency dimension and count cross-half contributions.
- Aliens trick / Lagrangian relaxation: penalties, count ties, convexity, and skipped-count traps.
- Slope trick: represent convex piecewise-linear costs through slope changes and shifts.
- Monge arrays and SMAWK: total monotonicity and row-minimum hypotheses.
- Ranked subset convolution: add cardinality to recover disjoint subset partitions.
- Plug DP: frontier connectivity labels and canonical encodings.
- Connected-subset DP: discard masks that cannot represent a meaningful partial structure.
Graphs, geometry, and combinatorics
- General graph matching: blossom contraction and augmenting-path restoration.
- Global minimum cut: Stoer-Wagner merging versus a single s-t cut.
- Dominator trees: mandatory vertices on directed root-to-vertex paths.
- Shortest-path dominator models: handle equal distances and zero-weight structure correctly.
- Palindromic trees: eertree nodes, suffix links, and distinct-palindrome counts.
- Failure-tree range queries: combine multiple-pattern structure with changing occurrence information.
- Rotating calipers: antipodal pairs, convex diameter, and extremal sweeps.
- Half-plane intersection: angle order, parallel boundaries, and bounded/unbounded regions.
- Polygon clipping: intersections, signed areas, and boundary degeneracies.
- Circle geometry: intersections, tangents, containment, and coincident cases.
- Minimum enclosing circle: randomized incremental construction and expected complexity.
- Formal power series inversion: Newton precision doubling and invertible constant terms.
- Polynomial division by reversal: recover a quotient through truncated inversion.
- CRT convolution: use enough transform primes for a proven integer coefficient bound.
- Lucas/generalized binomial arithmetic: separate prime-modulus and prime-power cases.
- Stirling numbers: both kinds and changes of polynomial basis.
- Catalan and ballot families: reflection arguments and boundary-constrained counting.
- Polya enumeration: cycle-index substitution beyond plain orbit counting.
- Matroid greedy: independent-set axioms and why arbitrary independence systems do not suffice.
- Misere games: last-move-loses rules and the limits of normal-play analysis.
Practice and exit gate
- Practice window: 2300-2800, combining long derivations with timed implementation.
- Training focus: retain a proof of the algebraic identity or amortized-update certificate, not only its formula.
- Grandmaster readiness: solve unfamiliar mixed tasks and choose a simpler correct method when complexity adds unnecessary risk.
Stage 9 - Grandmaster to international grandmaster (2600)
Polynomial and combinatorial machinery
- Formal logarithm and exponential: derivatives, integrals, constant terms, and truncation.
- Formal square/kth roots: leading coefficients, existence, and branch selection.
- Formal powers with large exponents: factor the leading zero order before applying log/exp.
- Generating functions: ordinary versus exponential series and coefficient extraction.
- Lagrange inversion: count recursively defined objects without expanding the recursion.
- Bostan-Mori: halve a distant index in rational coefficient extraction.
- Kitamasa/polynomial reduction: compute a distant term of a known linear recurrence.
- Berlekamp-Massey: infer a minimal recurrence over a field and validate it on unused terms.
- CDQ convolution DP: batch known-to-unknown transitions without reading future states.
- Multipoint evaluation and interpolation: product trees and remainder-tree traversal.
- Taylor shift: change a polynomial’s origin through factorial-weighted convolution.
- Binomial and Stirling transforms: choose the basis that makes a transition simple.
- Roots-of-unity filters: select coefficient congruence classes.
- Eulerian numbers and finite differences: connect ascent counts and polynomial sums.
Dynamic forests and structural tools
- Link-cut trees: path exposure, reversals, represented/auxiliary parents, and directional aggregates.
- Gomory-Hu trees: encode all-pairs undirected min-cuts with repeated flow computations.
- MST sensitivity: replacement edges, forced/banned edges, and second-best structures.
- Directed arborescences: Chu-Liu/Edmonds cycle contraction.
- Matrix-tree theorem: Laplacian minors, weights, and directed conventions.
- Treewidth DP: bag states, decomposition transitions, and width-dependent running time.
- Hall’s theorem as a reduction: turn a matching obstruction into an inequality or certificate.
- Parity orientation: combine Euler structure with required in/out-degree parity.
Specialized mathematics and strings
- Tonelli-Shanks and Cipolla: square roots in finite fields.
- Lifting the exponent: apply valuation identities only under their divisibility/parity hypotheses.
- Primitive roots and multiplicative order: determine group periods and allowable root orders.
- Faulhaber sums: evaluate polynomial power sums without iterating over the endpoint.
- Lehmer prime counting: count primes beyond a direct-sieve range.
- Palindromic series links: compress repeated suffix-palindrome DP transitions.
- Runs and periodicity: maximal periodic intervals and overlap constraints.
- LCP interval trees: aggregate substring information through suffix interval structure.
- Green Hackenbush: derive nimber structure in rooted impartial cut games.
Practice and exit gate
- Practice window: 2500-3100, including complete hard-contest upsolves.
- Training focus: discover the reduction before relying on a verified library to implement it.
- International-grandmaster readiness: repeatedly solve unfamiliar high-difficulty tasks and identify precisely what separates a near miss from a full solution.
Stage 10 - International grandmaster to legendary grandmaster (3000+)
High-end algebra and arithmetic
- Fast series composition and reversion: compose or invert a series under its leading-term conditions.
- Relaxed/online convolution: produce coefficients while future input is unknown.
- Chirp-z evaluation: values along a geometric progression via convolution.
- NTT doubling: extend an evaluation grid and reuse transforms.
- Bluestein transforms: reduce nonstandard transform lengths to supported convolution.
- Multivariate generating functions: choose variables to eliminate, encode, or truncate.
- Dirichlet convolution: express divisor sums as algebraic identities.
- Du Jiao sieve: memoize large summatory multiplicative-function values across quotient blocks.
- Min_25-style sieving: separate prime contributions and multiplicative extensions.
- Summatory floor products: Euclidean-recursive floor sums and lattice-point counts.
- Composite-ring algebra: distinguish an invertible unit from a merely nonzero value.
Specialist structures and search
- Matroid intersection: exchange graphs and augmentations for two independence constraints.
- Euler-tour trees: maintain a changing forest through dynamic Euler sequences.
- Offline dynamic MST: divide over time and filter forced/irrelevant edges.
- Planar duality: map cuts to cycles with the correct embedding and boundaries.
- BEST theorem: count Euler tours with explicit rooted and oriented conventions.
- Graph determinants beyond spanning trees: exploit signed sums and cancellation deliberately.
- Three-dimensional convex hulls: spatial orientation, faces, and degeneracies.
- Voronoi/Delaunay structures: nearest-site geometry and robust predicates.
- Minkowski sums: merge convex edge directions for separation/distance problems.
- Arrangement sweeps: handle events created by intersections as well as input endpoints.
- Color coding: small-pattern detection, random labels, and derandomization choices.
- Branch and bound: admissible bounds, search order, and exactness despite pruning.
- Decision-diagram compression: merge partial configurations with identical futures.
- SA-IS: linear-time suffix arrays through induced sorting.
- Compressed strings: reason over grammar/repetition structure without full expansion.
Practice and exit gate
- Practice window: 2800-3400, chosen for the missing idea rather than only the displayed number.
- Training focus: keep multiple approaches alive until a proof or constraint rules one out.
- Legendary-grandmaster readiness: invent difficult reductions under time pressure while remaining fast and accurate on the rest of the contest.
Stage 11 - Legendary grandmaster to consistent elite solver
Rare tools worth knowing exist
- Top trees: dynamic forest clusters and boundary summaries.
- Fully dynamic connectivity theory: replacement-edge hierarchies and amortized versus worst-case bounds.
- Weighted matroid intersection: potentials and shortest exchange augmentations.
- Weighted blossom: primal-dual reasoning beyond maximum-cardinality matching.
- Tutte matrix methods: randomized algebraic matching certificates and quantified error.
- Pfaffian methods: signed perfect-matching counts in structured graph families.
- Subset exponential/logarithm: set-partition combinatorics in subset-convolution algebra.
- Subset power-series operations: truncation and the required ring/field assumptions.
- Polynomial-coefficient recurrences: exploit transitions beyond constant-coefficient recurrences.
- Recurrence guessing with certification: separate experimental discovery from a mathematical proof.
- Holonomic/D-finite sequences: use a finite recurrence/differential description where justified.
- Hensel lifting: refine solutions modulo increasing prime powers.
- Finite-field extensions: represent algebraic elements absent from the base field.
- Lattice basis reduction: identify integer-relation and modular-reconstruction applications.
- Linear-programming duality: derive combinatorial bounds or optimality certificates.
- Exact cover and dancing links: reversible search on sparse covering constraints.
- Parameterized algorithms: put exponential work in a small structural parameter.
- Rank-based connectivity DP: compress large families of boundary partitions.
- Representative sets: retain partial solutions sufficient for all future extensions.
- Separator meet-in-the-middle: split across a graph/state boundary rather than just an array midpoint.
- Partizan and loopy games: asymmetric moves, draws, and the failure of ordinary nimber assumptions.
- Welter-type games: collision-constrained token games with specialized impartial structure.
Construction and optimization depth
- Adversarial construction: defeat an entire family of strategies, not just one test case.
- Extremal combinatorial bounds: use tight lower/upper bounds to design an output.
- Probabilistic existence proofs: turn a random existence argument into a usable construction.
- Conditional expectation: derandomize a construction while preserving its guarantee.
- Randomized fingerprints: quantify error under the actual adversary and comparison count.
- Las Vegas versus Monte Carlo: distinguish uncertain running time from uncertain correctness.
- Amortized rebuilding: schedule expensive reconstruction with a credit or potential argument.
- Frequency/degree heavy-light splits: select a threshold that balances two proven cost bounds.
- Low-level performance engineering: bit packing, permitted SIMD, and cache-aware layouts without semantic changes.
- Communication complexity: derive a lower bound and a protocol matching it when possible.
Practice and exit gate
- Practice target: 3000-3600 problems, demanding finals, and complete sets with hidden tags.
- Training focus: identify which rare branch is relevant instead of memorizing this entire section as a rank requirement.
- Elite readiness: repeatedly invent the main observation, recover from a wrong start, and finish tested code before the deadline.
Stage 12 - Elite to Jiangly/tourist-level training
Synthesis beyond a topic catalog
- Abstraction discovery: find a hidden ordering, state quotient, conservation law, or algebraic object.
- Cross-domain reductions: move between geometry, combinatorics, optimization, and algebra when that removes complexity.
- Constraint-tight design: exploit exact sum limits, value bounds, or change counts rather than a familiar headline bound.
- Lower-bound-driven invention: determine what information a solution must obtain before designing its queries.
- Proof-guided simplification: remove state or machinery because a stronger invariant makes it unnecessary.
- Independent alternative derivations: expose the real assumptions behind a hard result through a second argument.
- New decomposition design: choose a partition that makes both recursion and cross-part interactions affordable.
- Local-to-global certificates: prove when a small witness determines a global answer.
- Algorithm choice under uncertainty: compare correctness risk, constant factors, coding time, and remaining contest time.
- Contest portfolio management: decide when to secure points, pursue a difficult task, or abandon an unproductive approach.
- Adversarial self-review: attack the least-tested assumption in your own proof and implementation.
- Original problem setting: build a task, reference solution, counterexamples, and a credible difficulty assessment.
- Research-paper transfer: extract a practical special case without assuming every theoretical method is implementable within contest limits.
- Unfamiliar contest formats: adapt to communication, output-only, and optimization-scored tasks according to their actual rules.
- Library judgment: know which guarantees, excluded corner cases, and complexity bounds you are relying on.
A world-class practice cycle
- Attempt: take a genuinely unseen hard set under its intended time and assistance rules.
- Record: retain the reasoning paths tried and the evidence for abandoning each one.
- Isolate: identify the one observation or engineering decision separating the attempt from a finished solution.
- Rebuild: close the reference and independently derive the missing step.
- Transfer: solve a different task using the same underlying idea in a new form.
- Measure: track independent solve rate, full-contest consistency, proof quality, and time to a useful observation.
- Recover: maintain sleep, breaks, and sustainable practice across individual contest results.
Destination check
- A topic count is not a rank certificate. Knowing this list does not establish Jiangly or tourist-level strength.
- There is no guaranteed timeline. Let demonstrated independent performance choose the next weakness.
- There is no final trick. A new problem may need an observation absent from every reference.
- The target: accurate, repeated solutions to unfamiliar very difficult problems, with speed and reliability across the rest of the contest.
One training system for every stage
Learn once, then make the idea transferable
- Define: write the task family and exact preconditions.
- Derive: obtain the recurrence, invariant, exchange argument, or reduction before opening a template.
- Implement: write a version whose state layout and edge cases you understand.
- Verify: compare against a slow independent oracle on small randomized inputs.
- Recognize: solve an untagged application that hides the technique.
- Retain: revisit later and reproduce the reasoning with the reference closed.
Classify failures before choosing more problems
- Knowledge gap: a necessary theorem or algorithm was unknown.
- Modeling gap: you knew the tools but chose the wrong representation.
- Observation gap: the key invariant, ordering, or reduction never appeared.
- Proof gap: an unjustified assumption survived until a counterexample broke it.
- Implementation gap: correct reasoning was lost to numeric limits, indexing, state updates, or input handling.
- Execution gap: time allocation, panic, excessive coding, or a needless rewrite prevented a finish.
Maintain a compact problem log
- Problem link, date, difficulty, and whether tags were hidden.
- First useful observation and time spent finding it.
- Attempted approach and its exact failure point.
- Smallest counterexample or missing proof step.
- Reusable lesson without retelling the entire statement.
- A later independent revisit result.
Practice libraries and references
- Introductory and mixed practice: CSES.
- Recurrence practice: AtCoder Educational DP Contest.
- Implementation verification: Library Checker.
- Japanese implementation references: maspy and Nyaan.
- Study strong submissions after your own attempt: jiangly and tourist.
- Rank thresholds: Codeforces usage guide; Codeforces’ 4000 milestone announcement.
- Articles on this site: exact convolution, rollback connectivity, segment tree beats, and the complete Div. 1 round 250 editorial.
Support & Share
If this article helped you, please share or support!
Competitive Programming: From Zero to Jiangly
https://blog.wsh.moe/posts/cp-roadmap/Related PostsSmart
1
Link-Cut Trees: Expose a Path Before You Try to Aggregate It
Graph AlgorithmsSeparate the represented forest from auxiliary splay trees, then derive access, makeroot, safe cuts, and directional aggregates.
2
Aliens DP: A Penalty Removes a Dimension, Convexity Gives It Back
Advanced Dynamic ProgrammingUnderstand the supporting-line view of Lagrangian DP, monotone segment counts, tie breaking, and the skipped-count trap.
3
Bostan-Mori: The Trillionth Term Without a Trillion States
Polynomial AlgorithmsExtract a huge-index coefficient of a rational generating function by eliminating alternating coefficients.
4
CDQ Convolution DP: Batch Transitions Without Reading the Future
Polynomial AlgorithmsA dependency-first derivation of semi-online convolution with an exact-once proof and a worked recurrence.
5
Codeforces Round 162 (Div. 2) - A-E Editorial
Contest EditorialsFrom an ordered escape construction to prime-factor DP and a color-aware weighted subsequence.
Random PostsRandom





























































Conversation
Comments powered by Waline