結果

問題 No.406 鴨等間隔の法則
ユーザー kichirb3kichirb3
提出日時 2018-02-25 01:01:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 19,024 KB
最終ジャッジ日時 2023-09-21 18:44:43
合計ジャッジ時間 2,852 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
12,388 KB
testcase_01 AC 16 ms
7,844 KB
testcase_02 AC 16 ms
7,792 KB
testcase_03 AC 16 ms
7,732 KB
testcase_04 AC 66 ms
17,776 KB
testcase_05 AC 33 ms
11,620 KB
testcase_06 AC 33 ms
12,012 KB
testcase_07 AC 34 ms
11,924 KB
testcase_08 AC 68 ms
17,788 KB
testcase_09 AC 70 ms
18,864 KB
testcase_10 AC 36 ms
12,340 KB
testcase_11 AC 57 ms
16,608 KB
testcase_12 AC 42 ms
13,292 KB
testcase_13 AC 39 ms
13,124 KB
testcase_14 AC 66 ms
17,168 KB
testcase_15 AC 18 ms
8,788 KB
testcase_16 AC 20 ms
8,736 KB
testcase_17 AC 17 ms
8,388 KB
testcase_18 AC 19 ms
8,896 KB
testcase_19 AC 20 ms
8,932 KB
testcase_20 AC 22 ms
9,272 KB
testcase_21 AC 22 ms
9,376 KB
testcase_22 AC 28 ms
10,224 KB
testcase_23 AC 44 ms
13,708 KB
testcase_24 AC 60 ms
15,936 KB
testcase_25 AC 72 ms
18,980 KB
testcase_26 AC 78 ms
18,916 KB
testcase_27 AC 49 ms
18,912 KB
testcase_28 AC 49 ms
18,952 KB
testcase_29 AC 77 ms
19,024 KB
testcase_30 AC 75 ms
18,824 KB
testcase_31 AC 69 ms
18,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.406 鴨等間隔の法則
https://yukicoder.me/problems/no/406

"""
import sys
from sys import stdin

input = stdin.readline


def solve(positions):
    result = 'YES'
    positions.sort()
    dist = positions[1] - positions[0]
    if dist == 0:
        return 'NO'

    for a, b in zip(positions, positions[1:]):
        if b - a != dist:
            result = 'NO'
            break
    return result


def main(args):
    N = int(input())
    positions = [int(x) for x in input().split()]
    ans = solve(positions)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0