有 $n$ 個相異的整數 $a_1, a_2, \dots, a_n$,由左向右取,並且數字必須遞增,設最大長度為 $L$(即 Longest Increasing Subsequence)。
試問在這 $n$ 個整數當中,最多能找到幾組數字不重覆使用的 Longest Increasing Subsequence?
例如,序列 $3\ 1\ 8\ 4\ 9\ 5$ 的 $L=3$,最多可選出 $2$ 組數字不重覆使用的 LIS:$(1,8,9)$, $(3,4,5)$。
有多組測試資料,每組第一行為一個正整數 $n$ 表示數列長度,接下來有 $n$ 個數字照順序為 $a_1, a_2, \dots, a_n$。
當 $n=0$ 時結束。
對於每組測試資料輸出兩個數字:$L$ 和數字不重覆的 LIS 組數。
6 3 1 8 4 9 5 6 3 1 8 4 9 5 0
3 2 3 2
Migrated from old NTUJ.
2025-02-17 修正與補強測資
No. | Testdata Range | Score |
---|