結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
|
| 提出日時 | 2024-01-02 16:29:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 5,000 ms |
| コード長 | 347 bytes |
| コンパイル時間 | 270 ms |
| コンパイル使用メモリ | 82,296 KB |
| 実行使用メモリ | 57,500 KB |
| 最終ジャッジ日時 | 2024-09-27 17:47:45 |
| 合計ジャッジ時間 | 2,362 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(1,N-1):
ans += (A[i]>A[i-1])&(A[i]>A[i+1])&(A[i-1]!=A[i+1])
ans += (A[i]<A[i-1])&(A[i]<A[i+1])&(A[i-1]!=A[i+1])
print(ans)