結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-07-16 22:23:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 5,000 ms |
| コード長 | 333 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 82,288 KB |
| 実行使用メモリ | 53,488 KB |
| 最終ジャッジ日時 | 2024-07-16 22:23:38 |
| 合計ジャッジ時間 | 1,876 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
def is_match(a, b, c) -> bool:
if a == b or b == c or c == a: return False
if a < b < c: return False
if a > b > c: return False
return True
ans = 0
for i in range(N-2):
a, b, c = A[i], A[i+1], A[i+2]
if is_match(a, b, c):
ans += 1
print(ans)
norioc