結果

問題 No.116 門松列(1)
ユーザー 学ぶマン
提出日時 2025-08-03 21:37:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 242 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 53,508 KB
最終ジャッジ日時 2025-08-03 21:37:34
合計ジャッジ時間 2,254 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(1, N - 1):
    l, c, r = A[i - 1], A[i], A[i + 1]
    if l != c and c != r and r != l:
        if not (l < c < r) and not (l > c > r):
            ans += 1
print(ans)
0