IOI 2020
All 6 IOI tasks from 2020, 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.
Biscuits
There are x bags to fill with biscuits. Biscuit type i has tastiness 2^i, and there are a[i] biscuits of type i available. Each bag must have the same total tastiness y. Count the number of distinct values of y that a...
Comparing Plants
Plants are arranged on a circle. The value r[i] describes the local ranking constraint for plant i inside the next k positions. For each query (x,y), we must decide whether every valid height assignment forces x to be...
Connecting Supertrees
Given an n n matrix p where p[i][j] \ 0, 1, 2, 3\, construct a simple undirected graph on n nodes such that the number of distinct simple paths between nodes i and j equals p[i][j]. If no such graph exists, report it....
Mushrooms
There are n mushrooms, each either type A or type B. Mushroom 0 is known to be type A. You can query a function use\_machine(x) that takes a sequence of mushroom indices and returns the number of adjacent pairs in the...
Stations
Given a tree with n nodes, assign labels from \ 0, 1,, n-1\ (all distinct, but need not match node indices) such that given only the labels of the current node s and target node t, plus the sorted list of labels of s...
Tickets
There are n colors and m tickets per color. Ticket j of color i has value x[i][j] (sorted in non-decreasing order within each color). There are k rounds. In each round, exactly one ticket from each color is used (each...