結果
| 問題 |
No.116 門松列(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-23 22:33:22 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 371 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-06-25 01:01:48 |
| 合計ジャッジ時間 | 1,906 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#!/usr/bin/python
from itertools import izip, islice
each_cons = lambda xs, n: izip(*(islice(xs, i, None) for i in xrange(n)))
def valid(a, b, c):
if len(set((a, b, c))) != 3:
return 0
_, y, _ = sorted((a, b, c))
return y == a or y == c
n = int(raw_input())
As = map(int, raw_input().split())
print len(filter(lambda x: valid(*x), each_cons(As, 3)))