結果

問題 No.406 鴨等間隔の法則
ユーザー daku9640daku9640
提出日時 2016-10-14 06:32:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 21,736 KB
最終ジャッジ日時 2023-09-21 18:16:15
合計ジャッジ時間 3,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
15,072 KB
testcase_01 AC 15 ms
7,832 KB
testcase_02 AC 14 ms
7,824 KB
testcase_03 AC 15 ms
7,728 KB
testcase_04 AC 75 ms
20,856 KB
testcase_05 AC 37 ms
14,420 KB
testcase_06 AC 38 ms
14,084 KB
testcase_07 AC 37 ms
14,216 KB
testcase_08 AC 75 ms
20,944 KB
testcase_09 AC 81 ms
21,412 KB
testcase_10 AC 41 ms
15,236 KB
testcase_11 AC 63 ms
16,992 KB
testcase_12 AC 46 ms
14,736 KB
testcase_13 AC 44 ms
14,660 KB
testcase_14 AC 75 ms
20,424 KB
testcase_15 AC 17 ms
8,712 KB
testcase_16 AC 19 ms
9,436 KB
testcase_17 AC 17 ms
8,572 KB
testcase_18 AC 18 ms
9,600 KB
testcase_19 AC 20 ms
9,496 KB
testcase_20 AC 23 ms
10,052 KB
testcase_21 AC 22 ms
10,000 KB
testcase_22 AC 30 ms
13,036 KB
testcase_23 AC 47 ms
15,048 KB
testcase_24 AC 65 ms
16,032 KB
testcase_25 AC 83 ms
21,568 KB
testcase_26 AC 84 ms
21,736 KB
testcase_27 AC 52 ms
19,072 KB
testcase_28 AC 60 ms
21,320 KB
testcase_29 AC 86 ms
21,688 KB
testcase_30 AC 86 ms
21,516 KB
testcase_31 AC 79 ms
21,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def kamokan(n, x):
    q, r = divmod((x[-1] - x[0]),  (n - 1))
    if r == 1 or len(set(x)) != n:
        print("NO")
        return
    for i in range(1, n):
        if q != x[i] - x[i - 1]:
            print("NO")
            break
    else:
        print("YES")
    return

n = int(input())
x = sorted([int(i) for i in input().split()])

kamokan(n, x)
0