結果

問題 No.406 鴨等間隔の法則
ユーザー yumechi
提出日時 2016-08-22 23:36:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 92,544 KB
最終ジャッジ日時 2024-07-07 11:40:30
合計ジャッジ時間 3,673 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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