A. Apprentice Learning Trajectory
rdc亂編的做法
- 考慮貪心,每次會選擇結束時間最早的。
- 設當前時間為 \(x\),那么可以區間有兩類 a) \(l_i \leq x \leq r_i-t_i\),b) \(x \leq l_i\),用兩個堆維護選擇區間的結束時間。
- 堆被改變的次數與最優解變化次數都是 \(O(n)\) 級別的。
B. Balls of Buma
C. Cactus Revenge
D. DevOps Best Practices
E. Elections
F. Foolpr¨uf Security
G. Game Relics
H. Help BerLine
I. Intriguing Selection
265min, solved by rdc
做法:
- 先比較出長度為 \(x,y\) 的兩條鏈,滿足 \(x+y = n+1\),那么兩條鏈中最卜的元素不可能同時出現在前 \(n\) 大中。
- 每次淘汰掉較弱的那個,再插入一個新元素,讓兩條鏈的長度保持 \(x, y\)。
J. Just Arrange the Icons
K. Key Storage
139min, solved by rdc
做法:
- 數字可以得到一個唯一的序列,序列可以得到一個唯一的數字。
- 序列合法等價於,序列的第 \(i\) 位(1-index) 小於等於 \(i\),且,序列最高位不為 0.
- 枚舉最高位填啥,逐個考慮每位方案數,乘法原理。