Start here8 min

0. How to use this book

Reading modes, chapter prerequisites, and practice requirements.

Requires

Basic programming

Helpful

A Codeforces account

Used by

Chapters 1–38: all later instruction

Ready when

You can describe recognition, derivation, and implementation as separate levels of knowledge.

This book teaches the problem-solving knowledge and practice methods that are commonly required between Codeforces ratings 1000 and 1600.

The target rating of roughly 1600 defines the scope. You need reliable implementation, integer mathematics, explicit correctness proofs, and the algorithms listed in Chapters 12–28. You do not need every advanced competitive-programming algorithm.

Who this is for

You should already be comfortable with input, output, loops, conditionals, functions, lists, and a basic dictionary. You should also have solved a few 800–1000 problems. At a high level, you can explain why a nested loop is quadratic and why sorting costs O(n log n).

If Python itself is new, read the Python contest setup before the algorithm chapters. Every implementation uses ordinary Python 3 and the standard library. The book does not require advanced language features.

Reading modes

You can read the chapters in order because later chapters use terms from earlier chapters. You can also start with Chapter 36 and apply its performance checks. If a check fails, read the chapters listed as prerequisites for that skill. During review, search for the specific error, such as an incorrect monotonicity proof or visited-state update.

Every chapter has a prerequisite section. The “Ready when” field gives a performance check. Move on when you can perform that check without copying, even if your recall is not perfect.

Levels of technique knowledge

For every technique, distinguish three levels. Recognition means that you can identify the technique after someone names a relevant property. Derivation means that you can prove the required lemma from the statement and constraints. Implementation means that you can write and test the algorithm during a contest.

Reading a tutorial can produce recognition without derivation or implementation. The exercises and later re-solves test these levels separately.

Reading does not replace practice

Reading introduces a method and its conditions. Independent problem solving tests whether you can select, derive, and implement that method later.

After a technique chapter, do this:

  1. close the chapter;
  2. write the recognition cues and proof obligation from memory;
  3. implement the primitive once;
  4. solve one focused problem;
  5. solve one mixed, untagged problem later;
  6. revisit the key problem after several days.

The delay tests retrieval instead of immediate recognition. If you can explain a solution only just after reading it, you have not yet shown later recall.

General problem-solving procedure

Start by writing the facts from the statement and constructing small test cases. Write a correct brute-force algorithm. Identify repeated work and record claims about the problem structure. Prove each claim that the final algorithm requires. Then implement the algorithm and test boundary cases. After acceptance, record the problem-specific lemma and the condition that makes the method valid.

Experienced contestants perform familiar steps quickly because they have used the same proof and implementation patterns many times. Chapters 29–34 show each step explicitly.

What “complete” means here

Complete does not mean that every named algorithm in computer science appears. This book teaches the frequent families in the 1000–1600 range. It puts common prerequisites before their combinations. It also explains less frequent topics well enough for you to select the next prerequisite. Practice, contests, debugging, and psychological factors are part of the curriculum. The exclusions are explicit.

Flow, FFT, heavy-light decomposition, suffix arrays, and advanced geometry are outside the main scope. Chapter 28 names the prerequisites and typical use cases for later study.

Classify failures by cause

Do not use a failed problem as evidence about general personal ability.

A failure can result from missing knowledge, an incorrect representation, insufficient search, a proof error, an implementation error, poor time allocation, fatigue, or contest variance. Each cause requires a different corrective action. Record the cause that the available evidence supports.

What the book supplies

The complete edition contains three kinds of material. Concept chapters teach definitions, derivations, proofs, Python implementations, and known failure conditions. Worked analyses show how evidence changes a proposed solution. Practice sets connect each technical chapter to judged Codeforces problems.

Each practice problem has one of four labels. An Acquisition problem applies the chapter method directly. A Core problem adds one important decision or proof. A Transfer problem does not announce the method. A Stretch problem combines the chapter with later prerequisites.

Problem ratings are approximate difficulty indicators. A 1300 problem can be easy for one reader and difficult for another. Record the result instead of treating the number as a promise.

First-use procedure

Do not begin by reading all chapters. Use this procedure:

  1. read Chapters 0–3;
  2. complete the entry diagnostic in Chapter 36 without tags;
  3. classify each failure by missing knowledge or failed execution;
  4. select one technical chapter whose prerequisite check you satisfy;
  5. complete its teaching examples and Acquisition problems;
  6. attempt its Core and Transfer problems without the chapter open;
  7. review the result after a delayed re-solve.

If the diagnostic is mostly comfortable, start with the next rating band. If the diagnostic exposes several foundation gaps, repair one gap at a time.

Rules for independent attempts

An independent attempt can use the statement, language documentation, and your own reusable template. Do not use tags, editorials, solution videos, accepted code, or generated solution hints.

An attempt remains independent after ordinary syntax lookup. An attempt becomes assisted when an external source identifies a technique, observation, state, or proof step.

These labels measure the information available during the attempt. They do not measure intelligence or effort.

Minimum record

The minimum useful record has four lines:

Result: accepted | assisted | unfinished
Main claim:
Failure cause:
Next action and date:

Use the longer record in Chapter 38 only when a repeated error needs more evidence. Documentation must support practice instead of replacing practice.

How to test a chapter

A chapter is complete only when all three tests pass.

Explanation test: explain the method, its proof obligation, and one invalid use without notes.

Implementation test: write the reusable part in Python and test its boundary cases.

Transfer test: solve an untagged problem that requires the method after a delay.

Failure on one test identifies the next action. Rereading is appropriate for a missing definition. Reconstruction is appropriate for weak recall. Another problem is appropriate for weak transfer.

Chapter summary

  • Treat recognition, derivation, and implementation as separate abilities.
  • Use prerequisites and readiness tests to select chapters instead of reading every chapter automatically.
  • Combine reading with delayed, untagged practice because reading cannot test independent problem solving.
Start · orientation

You can describe recognition, derivation, and implementation as separate levels of knowledge.