Dilworth's Theorem
转化为最长不下降子序列,然后按照那个二分的思路,找到位置不要直接替换,而是存起来,最后每个位置的所有数就是一条链
Dilworth
ABC457G - Catch All Apples
Find the minimum number of robots needed to collect all apples. Each robot starts operating from time and can move freely at a speed of at most . Each robot can collect apple if and only if it is at coordinate at time .
If , a single robot can collect both apple and iff
A set of apples collected by one robot forms a chain in this partial order. The problem asks for the minimum number of chains (robots) to cover all points.
By Dilworth’s Theorem, the minimum chain cover equals the size of the maximum antichain.
We can sort all points by ascending, and for equal , by descending, and find the Longest Increasing Subsequence (LIS) of .
1 | for (int i = 0; i < N; i++) { |
本部落格所有文章除特別聲明外,均採用CC BY-NC-SA 4.0 授權協議。轉載請註明來源 小明の雜貨屋!
評論
