結果

問題 No.1188 レベルX門松列
ユーザー boutarouboutarou
提出日時 2020-08-24 21:27:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 868 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,736 KB
最終ジャッジ日時 2024-04-24 03:50:51
合計ジャッジ時間 3,731 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 240 ms
17,536 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 81 ms
12,732 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 30 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 30 ms
10,752 KB
testcase_21 AC 30 ms
10,624 KB
testcase_22 AC 29 ms
10,880 KB
testcase_23 AC 29 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

a = list(map(int, input().split()))

ans = 0
for i in range(1, n - 1):
    if (a[i - 1] > a[i] < a[i + 1]):
        left = i
        while(left > 0):
            if (a[left - 1] > a[left]):
                left -= 1
            else:
                break
        right = i
        while (right < n - 1):
            if (a[right] < a[right + 1]):
                right += 1
            else:
                break
        ans = max(right - i, i - left)

    elif (a[i - 1] < a[i] > a[i + 1]):
        left = i
        while(left > 0):
            if (a[left - 1] < a[left]):
                left -= 1
            else:
                break
        right = i
        while (right < n - 1):
            if (a[right] > a[right + 1]):
                right += 1
            else:
                break
        ans = max(right - i, i - left)

print(ans)
0