HydroOJ Daily Problem #001

This article presents the solution for the first daily problem from HydroOJ (September 3, 2021): [COCI2018-2019 Final T4] TENIS. Problem Statement Vito is organizing a tennis tournament with n players (numbered 1 to n). He has ranking lists for three court types: clay, grass, and hard court. The tournament consists of n−1 matches. In each match ...

Posted on Mon, 05 Oct 2026 16:38:10 +0000 by june_c21

Advanced Re-rooting Dynamic Programming Walkthrough

Re-rooting DP is a tree-DP variant that looks intimidating at first, yet becomes very mechenical once the pattern is recognized. The following problems illustrate the key techniques. Problem 1 – USACO 2012 FEB "Nearby Cows" Task: for every node i compute the sum of weights of all nodes whose distance to i is at most K. Constraints: n ...

Posted on Wed, 29 Jul 2026 16:38:52 +0000 by daf_cr

Interval DP Solution for Zuma-like Ball Elimination Problem

The elimination rule—removing consecutive identical elements when their count reaches a threshold $k$—suggests an interval dynamic programming approach. A two-dimensional DP state is insufficient because it cannot capture how the leftmost element in a segment is eventually removed. To resolve this, we introduce a third dimension that tracks how ...

Posted on Sat, 23 May 2026 20:25:04 +0000 by joukar