結果

問題 No.1188 レベルX門松列
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-09-02 00:49:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 24,880 KB
最終ジャッジ日時 2024-05-01 02:23:15
合計ジャッジ時間 5,272 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 315 ms
19,020 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 235 ms
14,676 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 25 ms
10,752 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 27 ms
10,880 KB
testcase_21 AC 25 ms
10,752 KB
testcase_22 AC 24 ms
10,752 KB
testcase_23 AC 25 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
left_upper = [1 for i in range(N)]
left_downer = [1 for i in range(N)]
right_upper = [1 for i in range(N)]
right_downer = [1 for i in range(N)]

for i in range(1, N):
    if A[i-1] < A[i]:
        left_upper[i] = left_upper[i-1] + 1

for i in range(1, N):
    if A[i-1] > A[i]:
        left_downer[i] = left_downer[i-1] + 1

A.reverse()

for i in range(1, N):
    if A[i-1] < A[i]:
        right_upper[i] = right_upper[i-1] + 1

for i in range(1, N):
    if A[i-1] > A[i]:
        right_downer[i] = right_downer[i-1] + 1

ans = 0

for i in range(N):
    ans = max(ans, min(left_upper[i], right_upper[N-1-i]),
              min(left_downer[i], right_downer[N-1-i]))

print(ans - 1)
0