結果

問題 No.116 門松列(1)
ユーザー togatoga
提出日時 2015-08-19 10:07:42
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 335 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-06-25 01:08:52
合計ジャッジ時間 1,199 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
A = map(int, raw_input().split())
res = 0
for i in range(N - 2):
    a = A[i]
    b = A[i + 1]
    c = A[i + 2]
    list1 = [[a, 1], [b, 2], [c, 3]]
    sortlist1= sorted(list1, key=lambda x:x[0], reverse=True)
    if (a == b or b == c or a == c):
        continue
    if (sortlist1[1][1] != 2):
        res += 1
print res
0