IOI 2012
All 6 IOI tasks from 2012, organized as individual solution pages.
Problem set
Each entry below goes straight to the public problem page, with the statement, editorial, code, and raw resources kept together.
Crayfish Scrivener
Implement a text editor with three operations: TypeLetter(c): Append character c to the current text. UndoCommands(u): Undo the last u commands, restoring the text to its state u operations ago. Undo can undo other un...
Ideal City
A city consists of N unit-square blocks on a grid (connected via shared edges). The distance between two blocks is the shortest path length through adjacent blocks. Compute the sum of pairwise shortest-path distances...
Jousting Tournament
There are N final positions, one of which will be occupied by the late knight of rank R. The other N-1 positions contain the ranks in array K in their original order. For each round i, the master removes the consecuti...
Last Supper
N people arrive in order, each preferring a color C[i] (from K possible colors). Chairs are numbered 0 to N-1. The advisor sees the full sequence C[0..N-1] and writes one advice bit per person. The assistant uses thes...
Odometer
A robot on an R C grid has two odometers: one counting horizontal moves and one counting vertical moves. Given a start and target position (with obstacles), find a path where the horizontal and vertical odometer readi...
Parrots
Encode a message of N 64 bytes into a multiset of integers in [0,255]. The decoder receives the integers in arbitrary order and must reconstruct the original message exactly.