結果

問題 No.116 門松列(1)
ユーザー トミートミー
提出日時 2024-04-12 23:55:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 53,968 KB
最終ジャッジ日時 2024-04-12 23:55:55
合計ジャッジ時間 2,621 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,316 KB
testcase_01 AC 37 ms
52,504 KB
testcase_02 AC 37 ms
52,988 KB
testcase_03 AC 39 ms
52,600 KB
testcase_04 AC 38 ms
52,524 KB
testcase_05 AC 37 ms
53,968 KB
testcase_06 AC 37 ms
53,792 KB
testcase_07 AC 38 ms
52,948 KB
testcase_08 AC 38 ms
53,076 KB
testcase_09 AC 38 ms
53,476 KB
testcase_10 AC 39 ms
52,660 KB
testcase_11 AC 38 ms
52,200 KB
testcase_12 AC 38 ms
52,928 KB
testcase_13 AC 38 ms
52,440 KB
testcase_14 AC 40 ms
52,764 KB
testcase_15 AC 38 ms
53,080 KB
testcase_16 AC 38 ms
52,644 KB
testcase_17 AC 38 ms
52,740 KB
testcase_18 AC 39 ms
52,344 KB
testcase_19 AC 38 ms
52,460 KB
testcase_20 AC 37 ms
53,092 KB
testcase_21 AC 37 ms
52,888 KB
testcase_22 AC 37 ms
53,488 KB
testcase_23 AC 37 ms
52,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dif(a,b,c):
    return (a!=b and b!=c and c!=a)

def main():
    n=int(input())
    l_list=list(map(int,input().split()))
    cnt=0
    for i in range(len(l_list)-2):
        a=l_list[i]
        b=l_list[i+1]
        c=l_list[i+2]
        cnt=cnt+1 if dif(a,b,c) and (b==max(a,b,c) or b==min(a,b,c)) else cnt
    print(cnt)
        
        


if __name__ == "__main__":
    main()
0