結果

問題 No.116 門松列(1)
コンテスト
ユーザー lllllll88938494
提出日時 2023-05-30 01:32:26
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 24 ms / 5,000 ms
+ 493µs
コード長 235 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 66 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 55,992 KB
最終ジャッジ日時 2026-10-09 00:30:47
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
a=list(map(int,input().split()))
cnt = 0

for i in range(n-2):
    if len({a[i],a[i+1],a[i+2]}) < 3:
        continue

    if a[i] < a[i+1] < a[i+2] or a[i] > a[i+1] > a[i+2]:
        continue

    cnt+=1
    
print(cnt)
0