Ybt 1742 hamon \color{green}{\texttt{Ybt 1742 hamon}} Ybt 1742 hamon
[Problem in short] \color{blue}{\texttt{[Problem in short]}} [Problem in short]
给定序列 a 1 ⋯ n a_{1 \cdots n} a1⋯n,求其最长严格上升子序列的长度及数量(对 123456789 123456789 123456789 取模)。
1 ≤ n ≤ 1 × 1 0 5 , 1 ≤ max i = 1 n { a i } ≤ 1 × 1 0 5 1 \leq n \leq 1\times 10^{5},1 \leq \max\limits_{i=1}^{n} \{ a_{i} \} \leq 1 \times 10^{5} 1≤n≤1×105,1≤i=1maxn{ ai}≤1×105。
[Solution] \color{blue}{\texttt{[Solution]}} [Solution]
记只考虑 a 1 ⋯ i a_{1 \cdots i} a1⋯i 并 a i a_{i} ai 作为子序列结尾时的最长严格上升子序列长度为 f i f_{i} fi,数量为 g i g_{i} gi