結果

問題 No.1188 レベルX門松列
ユーザー marroncastlemarroncastle
提出日時 2020-08-22 15:18:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,484 KB
最終ジャッジ日時 2024-04-23 09:39:51
合計ジャッジ時間 3,097 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    dif = [0]*(N-1)
    for i in range(N-1):
        dif[i] = A[i+1]-A[i]
    lis = [1]
    ans = 0
    i = 1
    while i<N-1:
        if dif[i]*dif[i-1]>0:
            lis[-1] += 1
        elif dif[i]*dif[i-1]<0:
            lis.append(1)
        else:
            for j in range(len(lis)-1):
                ans = max(ans, min(lis[j],lis[j+1]))
            lis = []
        i += 1
    for j in range(len(lis)-1):
        ans = max(ans, min(lis[j],lis[j+1]))
    return ans
print(solve())
0