Slide 講義
延伸閱讀
非常建議把 CSES 的 Searching & Sorting 都寫一遍
link : https://cses.fi/problemset/list/
裡面有很多資料結構( STL
pbds
BIT
)與排序、搜尋搭配的經典技巧!
近幾次的 APCS 第四題都跟延伸閱讀的題單蠻相似的!
link : https://zerojudge.tw/ShowProblem?problemid=f819
link : https://toj.tfcis.org/oj/pro/575/
要注意輸出格式: 行尾不要有空白
link : https://zerojudge.tw/ShowProblem?problemid=a915
用 pair
的話:連 struct
, compare function
都不用寫!
link : https://zerojudge.tw/ShowProblem?problemid=b304
輸入格式: 要用 getline
讀
其他: 空字串也算正確
link : https://zerojudge.tw/ShowProblem?problemid=i400
題目頗長,要仔細看,解碼要記得反著做
link : https://cses.fi/problemset/task/1621
link : https://zerojudge.tw/ShowProblem?problemid=f607
二分搜
跟 iterator
link : https://cses.fi/problemset/task/1640
link : https://leetcode.com/problems/kth-largest-element-in-an-array/
嘗試用 的時間複雜度來解
link : https://cses.fi/problemset/task/1076
這題預設用 priority_queue
解,不過也可以用 multiset
( 其實後者應該比較好想怎麼解XD )
還有 pbds
跟 binary index tree
也可以解
3.
所以需要另一個資料結構來紀錄「哪些元素已經不在 window 中 」這個狀態如果想知道題怎麼用其他資料結構來解的話:
可以看 這邊
題解
資料結構
競程