結果

問題 No.406 鴨等間隔の法則
コンテスト
ユーザー yumechi
提出日時 2016-08-22 23:36:45
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 129 ms
コンパイル使用メモリ 84,676 KB
実行使用メモリ 93,176 KB
最終ジャッジ日時 2026-03-29 02:03:30
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve():
    n = int(input())
    xl = sorted([int(i) for i in input().split()])

    # condition 1
    if len(set(xl)) != n:
        print("NO")
        return

    #condition 2
    diff = abs(xl[0] - xl[1])
    for idx in range(1, n):
        if diff != abs(xl[idx-1] - xl[idx]):
            print("NO")
            return
    else:
        print("YES")

if __name__=="__main__":
    solve()
0