Competitive Programming

IOI 2013

All 6 IOI tasks from 2013, organized as individual solution pages.

6 problem pages
6 editorials
6 C++ solutions
May 21, 2026 most recently updated solution

Problem set

Each entry below goes straight to the public problem page, with the statement, editorial, code, and raw resources kept together.

IOI 2013

Art Class

Given an image (2D grid of RGB pixels), classify it into one of four categories: Class 1: Modern/abstract art (few colors, large uniform regions) Class 2: Paintings with distinct objects (moderate variation) Class 3:...

TeX C++
Open problem page
IOI 2013

Cave

There is a cave with N doors (numbered 0 to N-1) and N switches (numbered 0 to N-1). Each switch controls exactly one door (a permutation), and each switch has a correct position (0 or 1) that opens its corresponding...

TeX C++
Open problem page
IOI 2013

Dreaming

Given a forest (collection of trees) with N nodes and M edges (each with a weight), you can add edges of weight L to connect the trees into a single tree. Minimize the diameter (longest shortest path between any two n...

TeX C++
Open problem page
IOI 2013

Game

Given a 2D grid of size R C (up to 10^9 10^9), support two operations: Update (r, c, v): Set the value at cell (r, c) to v. Query (r_1, c_1, r_2, c_2): Return the GCD of all values in the rectangle [r_1, r_2] [c_1, c_...

TeX C++
Open problem page
IOI 2013

Robots

There are A ``weak'' robots (each with a weight limit X_i) and B ``small'' robots (each with a size limit Y_j). There are T toys, each with weight W_k and size S_k. A weak robot i can pick up toy k if W_k < X_i. A sma...

TeX C++
Open problem page
IOI 2013

Wombats

Given a grid of R rows and C columns (R 5000, C 200), with horizontal edges (within each row) and vertical edges (between consecutive rows), each having a non-negative weight. Support two operations: changeH (r, c, w)...

TeX C++
Open problem page