TopCoder

FHVirus
想像不出自己 AC 的題目是實作不出來的!

User's AC Ratio

86.8% (66/76)

Submission's AC Ratio

63.8% (153/240)

Tags

Description

給你一個序列, 請你求出LIS

等等!你以為我會叫你求Longest Increasing Subsequence嗎?
天下才沒有這種好事咧!

我要你求的是Least Increasing Subsequences!

你該不會又天真的認為這是"最短遞增子序列吧",那你又錯了!
我雖然善良但也沒有這麼善良

你的任務,事實上,是把這個序列分成其若干個子序列
其中每一個都是嚴格遞增子序列

Input Format

每次輸入只有一組測試資料

第一行為一整數n,代表序列項數
接下來有n個以空格或換行分隔的數字,依序代表每項的值。

1 <= n <= 200
你可以假設合理地用int運算不會出問題。

Output Format

請輸出一個整數,代表至少要分成幾個序列。

Sample Input 1

21
1 2 5 3 9 11 7 12 8 18 19 20 13 14 21 22 19 23 24 28 25

Sample Output 1

2

Hints

分成1,2,3,7,8,13,14,19,25
 和5,9,11,12,18,19,20,21,22,23,24,28

Problem Source

原TIOJ1240 / TIOJ例行賽IV, Problem Setter: kelvin

Subtasks

No. Testdata Range Score
1 0~13 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 200 65536 262144 1
1 200 65536 262144 1
2 200 65536 262144 1
3 200 65536 262144 1
4 200 65536 262144 1
5 200 65536 262144 1
6 200 65536 262144 1
7 200 65536 262144 1
8 200 65536 262144 1
9 200 65536 262144 1
10 200 65536 262144 1
11 200 65536 262144 1
12 200 65536 262144 1
13 200 65536 262144 1