提出 #7680247


ソースコード 拡げる

#!/usr/bin/env python3
import sys


def solve(n: int, p: "List[int]"):
    result = 0
    for i in range(len(p) - 2):
        if p[i] < p[i + 1] and p[i + 1] < p[i + 2]:
            result += 1
        elif p[i] > p[i + 1] and p[i + 1] > p[i + 2]:
            result += 1
    print(result)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, p)

if __name__ == '__main__':
    main()

提出情報

提出日時
問題 B - Ordinary Number
ユーザ showwin
言語 Python (3.4.3)
得点 200
コード長 794 Byte
結果 AC
実行時間 17 ms
メモリ 3064 KiB

ジャッジ結果

セット名 All Sample
得点 / 配点 200 / 200 0 / 0
結果
AC × 14
AC × 2
セット名 テストケース
All sample_01, sample_02, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12
Sample sample_01, sample_02
ケース名 結果 実行時間 メモリ
sample_01 AC 17 ms 3064 KiB
sample_02 AC 17 ms 3064 KiB
testcase_01 AC 17 ms 3064 KiB
testcase_02 AC 17 ms 3064 KiB
testcase_03 AC 17 ms 3064 KiB
testcase_04 AC 17 ms 3064 KiB
testcase_05 AC 17 ms 3064 KiB
testcase_06 AC 17 ms 3064 KiB
testcase_07 AC 17 ms 3064 KiB
testcase_08 AC 17 ms 3064 KiB
testcase_09 AC 17 ms 3064 KiB
testcase_10 AC 17 ms 3064 KiB
testcase_11 AC 17 ms 3064 KiB
testcase_12 AC 17 ms 3064 KiB