0w1

Smaller to larger

Bangladesh OI 2016 National Round pE. Village Fair ( Smaller to Larger )

http://codeforces.com/gym/101212/attachments/download/5014/bangladesh-informatics-olympiad-2016-en.pdf Dashboard - Bangladesh Informatics Olympiad 2016 - Codeforces題意: 有 N 個房子,一開始裡面都有一個小屁孩,用屁孩值描述。每個房子的出度…

Yuki 416 旅行会社 ( Union Find, Smaller to Larger, Time Reverse )

No.416 旅行会社 - yukicoder題意: 給一個圖,和破壞邊的順序 ( 不一定會將所有橋破壞 )。對於所有大於 0 的節點,求哪一次破壞後無法從 0 達到。若一開始就不能到達,輸出 0,若破壞完依然能到達,輸出 -1。資料規模: 節點數 2≤N≤1e5 初始橋的數量 1≤M≤2e…

CFR 713 C. Sonya and Problem Wihtout a Legend ( Priority Queue + Median + Smaller to Larger )

Problem - 713C - Codeforces 題意: 給一組數列,每次操作可以將一個數字增加或減少 1,求最少的操作數,使得數列嚴格遞增。 解法: 首先看到嚴格遞增,將每個數字減去自己的下標後,就可以轉換成非嚴格遞增,題目或許會比較好解。接著考慮,如果有幾個數字…

CFR Educational 2 E. Lomsat gelral ( Smaller to Larger or Time stamp + Mo's Algorithm )

Problem - E - Codeforces The official solution is to simply merge subtrees from the leaves to the root. Using the smaller to larger strategy, where we always merge the smaller subtree towards the larger, the overall time complexity is O( (…