Transitive Closure and Bitset Optimization for Partial Order Completion
Problem
Luogu P2881
Given \(n\) numbers and \(m\) relations of the form \(a > b\), determine how many additional pairwise comparisons are needed to deduce the total order of all numbers.
Solution
Two approaches exist: Floyd‑Warshall and topological sort. This article focuses on the latter.
If no relations are given, we need to check every pa ...
Posted on Wed, 22 Jul 2026 16:44:38 +0000 by jviney