結果
| 問題 | No.116 門松列(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-17 21:54:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 5,000 ms |
| + 94µs | |
| コード長 | 276 bytes |
| 記録 | |
| コンパイル時間 | 593 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 78,976 KB |
| 最終ジャッジ日時 | 2026-07-25 13:45:05 |
| 合計ジャッジ時間 | 3,345 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
N = int(input())
lsA = list(map(int,input().split()))
cnt = 0
for i in range(N-2):
if lsA[i] < lsA[i+1] and lsA[i+1] > lsA[i+2] and lsA[i] != lsA[i+2]:
cnt += 1
elif lsA[i] > lsA[i+1] and lsA[i+1] < lsA[i+2] and lsA[i] != lsA[i+2]:
cnt += 1
print(cnt)