TopCoder

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

User's AC Ratio

100.0% (50/50)

Submission's AC Ratio

61.9% (73/118)

Tags

Description

在一個神秘的地區有 n 座山排成一直線,每座山都有一個高度 h_i,
而在一座山 a 能看到另一座山 b 的條件是 a 和 b 之間所有山的高度都比 a 低。

請幫每一座山計算他能夠看到幾座山...(包含它自己)

Input Format

有多組測試資料,用 EOF 代表結束。


每組測資第一行是一個整數 n,(1 <= n <= 100000)
接下來第二行有 n 個整數,代表這些山(由左到右)的高度。
(0 <= h_i < 1000000000)

Output Format

每組測資輸出一行,要有 n 個整數分別代表從左到右每座山能看到的山的個數。

Sample Input 1

5
1 2 3 4 5
3
1 2 1

Sample Output 1

2 3 4 5 5
2 3 2

Hints

Problem Source

原TIOJ1721 / Problem Setter: akira

Subtasks

No. Testdata Range Score
1 0 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 131072 262144 1