IOI 1999
All 3 IOI tasks from 1999, 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.
Code (Gray Codes)
Problem Statement Generate a Gray code of N bits: a cyclic sequence of all 2^N binary strings of length N such that consecutive strings (including the last and first) differ in exactly one bit. Solution Approach Refle...
Flower Shop
Problem Statement There are F flowers and V vases in a row (F V). Each flower i has a preference value pref[i][j] for vase j. Flowers must be placed in strictly increasing vase order: v_1 < v_2 < < v_F. Maximize the t...
Road Network (Tree Median)
Problem Statement Given a weighted tree with N nodes, find the node v that minimizes the sum of distances to all other nodes: S(v) = _ u=1 ^ N d(v, u). Output that node and the minimum sum. Solution Approach Rerooting...