QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22469. 山の観察

Statistics

ある日 Bessie は遠くの美しい Wisconsin の山々を眺め、どれが最も幅広いか考えました。

新しい Acme Long Distance Geoaltimeter で地平線に沿って順に $N$($1 \le N \le 10,000$)個の高さ $H_{i}$($1 \le H_{i} \le 1,000,000,000$)を測ります。

山とは連続する $H_{i}$ の列で、まず増加(または不変)し、次に減少(または不変)するものです。例は 2, 3, 3, 5, 4, 4, 1。視野の端では増加のみ、減少のみでも構いません。

山の幅は含まれる測定値の数です。Bessie が最も幅広い山を見つけるのを手伝ってください。

典型的な地平線の簡単な例です。

           *******                   *
          *********                 ***
          **********               *****
          ***********           *********               *
*      *****************       ***********             *** *
**    *******************     *************   * *     *******      *
**********************************************************************
?ddsssuussuussssssddddssddssssuuuuuuuuddddddssududssssuuudduddsssssuds
3211112333677777776543332111112344456765432111212111112343232111111211
aaaaa                     cccccccccccccccccccc eeeeeee    ggggggggg
  bbbbbbbbbbbbbbbbbbbbbbbbbbbb             ddddd ffffffffff  hhhhhhhhh

山には 'a'、'b' などの印があります。明らかに b が最も幅広く、幅 28 です。

ヒント:最高部分の位置を知ると幅を最も簡単に求められることがあります。

入力

  • 1 行目:整数 $N$。

  • $2..N+1$ 行目:$i+1$ 行目に整数 $H_{i}$。

出力

  • 1 行目:最も幅広い山の幅を整数1個で1行に出力します。

入出力例

入力 1

7
3
2
3
5
4
1
6

出力 1

5

注記

高さは 3, 2, 3, 5, 4, 1, 6 です。

最も幅広い山は 2, 3, 5, 4, 1。ほかに 3, 2 や 1, 6 の山があります。

問題作成:Jeffrey Wang、2009

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.