結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2020-04-17 14:37:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 290 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 82,828 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2024-10-03 10:17:43 |
| 合計ジャッジ時間 | 1,756 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(n-2):
if A[i] == A[i+1] or A[i+1] == A[i+2] or A[i+2] == A[i]:
continue
if A[i] < A[i+1] and A[i+1] > A[i+2]:
ans += 1
if A[i] > A[i+1] and A[i+1] < A[i+2]:
ans += 1
print(ans)
brthyyjp