結果
問題 | No.116 門松列(1) |
ユーザー |
|
提出日時 | 2019-10-30 11:16:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 85 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-14 21:45:56 |
合計ジャッジ時間 | 1,759 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
class Problem0116: def solve(this): n = int(input()) a = list(map(int, input().split())) res = 0 for i in range(len(a) - 2): c = a[i:i+3] if len(c) != len(set(c)): continue if c[0] < c[1] and c[2] < c[1] or c[1] < c[0] and c[1] < c[2]: res += 1 print(res) if __name__ == "__main__": problem = Problem0116() problem.solve()