IOI 2023
All 5 IOI tasks from 2023, 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.
Beech Tree
Necessary conditions [Distinct-color condition] If any node in the subtree has two children sharing the same edge color, the subtree is not beautiful. Suppose node u has children c_1, c_2 with the same color. When c_1...
Closing Time
Given a weighted tree, two special vertices X and Y, and budget K, choose closing times to maximize the total number of vertices reachable from X and from Y.
Longest Trip
Case D = 3: complete graph Every pair is connected, so any permutation of all N nodes is a Hamiltonian path. Case D = 2 Any three nodes span at least 2 edges. A Hamiltonian path always exists. Case D = 1: general When...
Overtaking
Key observation The reserve bus's presence does not affect the non-reserve buses' mutual blocking order among themselves. A slower non-reserve bus i only blocks the reserve bus if i arrived at the previous station str...
Soccer Stadium
Problem Statement Given an N N grid where some cells contain trees (F[r][c] = 1), find the largest regular stadium: a set of empty cells such that any two cells can be connected by at most two straight kicks (horizont...