Skip to main content
QUESTLINE

Competitive Programming — High School Beginner

The Vietnamese Học sinh giỏi preparation path: reading statements, complexity, marking arrays, sorting and binary search, prefix and difference arrays, strings, number theory, STL, recursion and backtracking, basic DP, graphs, and four mock contests. Every problem is graded for real in the C++20 sandbox.

📜 65 lessons⚡ 0 challenges⏳ ~15.5 hours⭐ Beginner — no experience needed

Who this course is for

High-school students (grades 10–12) preparing for Tin học chọn Học sinh giỏi from school rounds to provincial level; basic C++ knowledge (or taking cpp-beginner in parallel).

What you will be able to do

  • Read a contest statement and extract exact constraints, I/O format, and subtasks
  • Estimate complexity and pick an algorithm that fits the time limit
  • Implement marking/frequency arrays, sorting, binary search, prefix and difference arrays fluently
  • Solve string, number-theory (sieve), STL, recursion, and backtracking problems
  • Solve basic DP and BFS/DFS graph problems at provincial-HSG level
  • Sit four mock contests with subtasks and manage a 180-minute exam
CHAPTER 1· 3 Waypoints

Contest Reading & the C++ Bridge

Read a real statement (input/output/constraints/examples), understand judge verdicts, and take the solve(istream&, ostream&) convention used across the whole track.

CHAPTER 2· 3 Waypoints

Loops as Simulation

for/while as simulation engines: counters, accumulators, digit processing, and repeated computation — the patterns hidden inside most easy HSG problems.

CHAPTER 3· 3 Waypoints

Arrays

Indexing, traversal, min/max, counting, reverse and rotate — the array mechanics behind half of all easy HSG problems.

CHAPTER 4· 3 Waypoints

Marking & Frequency Arrays

The mảng đánh dấu technique: presence flags, frequency counting, and the value-range rule that decides when it is even possible.

CHAPTER 5· 3 Waypoints

Greedy Basics

Sorting + greedy choice with exchange-argument reasoning — and the counterexamples that kill bad greedy strategies.

CHAPTER 6· 3 Waypoints

Sorting

std::sort, custom comparators, and the sort-then-sweep family: min difference, merged intervals, and ranking.

CHAPTER 7· 3 Waypoints

Searching & Binary Search

Linear search, binary search as an invariant, lower_bound/upper_bound, and binary search on the answer.

CHAPTER 8· 3 Waypoints

Prefix Sums

Answer range-sum queries in O(1): 1D and 2D prefix sums, prefix counting, zero-sum subarrays, fixed-window maximum.

CHAPTER 9· 3 Waypoints

Difference Arrays

O(1) range updates: 1D difference arrays, reconstruction by prefix sum, 2D rectangle painting, exact-coverage counting.

CHAPTER 10· 3 Waypoints

Strings

std::string mechanics: indexing, traversal, palindromes, run-length encoding, anagram signatures, and a first honest look at counting distinct substrings.

CHAPTER 11· 3 Waypoints

Basic Number Theory

Divisibility, gcd/lcm with Euclid, divisors and primes in O(sqrt n), digit sums, and modular thinking for sums.

CHAPTER 12· 3 Waypoints

STL for Contests

The standard containers as problem-solving tools: vector, set, map, priority_queue, stack, queue, deque — chosen by problem shape.

CHAPTER 13· 3 Waypoints

Recursion

Functions that call themselves: base cases, tracing the stack, factorial and combination identities, recursive number tricks.

CHAPTER 14· 3 Waypoints

Backtracking

Systematic exhaustive search: choose, explore, uncommit — and prune so the search tree stays small enough to finish.

CHAPTER 15· 3 Waypoints

Dynamic Programming Basics

Stop recomputing: define a state, a transition, and base cases — then fill a table instead of recursing forever.

CHAPTER 16· 3 Waypoints

Graph Theory Fundamentals

Store a graph as adjacency lists, then walk it: BFS for shortest unweighted paths, DFS for structure, flood fill for grids.

CHAPTER 17· 3 Waypoints

Two Pointers & Sliding Window

Turn O(n^2) pair scans into O(n): two indices that each move forward at most n times.

CHAPTER 18· 3 Waypoints

Contest Technique

Read constraints like a lawyer, budget operations like an engineer, and bank partial credit like an investor.

CHAPTER 19· 3 Waypoints

Debugging Competitive Programs

Wrong answers are clues: reproduce, isolate, instrument, fix — then re-test the boundary that broke you.

CHAPTER 20· 8 Waypoints

Beginner Contest Series

Three mock contests mixing every beginner tool — time management and problem selection are graded skills too.