結果

問題 No.406 鴨等間隔の法則
ユーザー RK PythonRK Python
提出日時 2020-06-01 22:22:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 21,516 KB
最終ジャッジ日時 2023-08-14 14:30:32
合計ジャッジ時間 4,030 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
14,928 KB
testcase_01 AC 15 ms
7,756 KB
testcase_02 AC 15 ms
7,796 KB
testcase_03 AC 16 ms
7,896 KB
testcase_04 AC 55 ms
21,016 KB
testcase_05 AC 30 ms
14,156 KB
testcase_06 AC 31 ms
14,496 KB
testcase_07 AC 31 ms
14,612 KB
testcase_08 AC 53 ms
21,516 KB
testcase_09 AC 58 ms
20,940 KB
testcase_10 AC 32 ms
15,012 KB
testcase_11 AC 46 ms
16,928 KB
testcase_12 AC 37 ms
14,904 KB
testcase_13 AC 35 ms
14,488 KB
testcase_14 AC 99 ms
20,104 KB
testcase_15 AC 16 ms
8,744 KB
testcase_16 AC 28 ms
9,636 KB
testcase_17 AC 22 ms
8,808 KB
testcase_18 AC 27 ms
9,504 KB
testcase_19 AC 23 ms
9,616 KB
testcase_20 AC 26 ms
9,908 KB
testcase_21 AC 36 ms
9,996 KB
testcase_22 AC 38 ms
12,764 KB
testcase_23 AC 38 ms
15,280 KB
testcase_24 AC 82 ms
16,476 KB
testcase_25 AC 59 ms
20,992 KB
testcase_26 AC 110 ms
21,116 KB
testcase_27 AC 51 ms
18,912 KB
testcase_28 AC 58 ms
21,028 KB
testcase_29 AC 113 ms
21,004 KB
testcase_30 AC 114 ms
20,932 KB
testcase_31 AC 58 ms
20,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = [int(i) for i in input().split()]
if len(set(x)) == len(x):
    x.sort()
    xd = {}
    for i in range(1,N):
        d = x[i] - x[i-1]
        try:
            xd[d] += 1
        except:
            xd[d] = 1
    print("YES" if len(xd.keys()) == 1 else "NO")
else:
    print("NO")
0