結果

問題 No.135 とりあえず1次元の問題
ユーザー neko_the_shadow
提出日時 2017-03-25 23:05:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 296 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 20,972 KB
最終ジャッジ日時 2024-07-06 06:17:02
合計ジャッジ時間 2,611 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == '__main__':
    n = int(input())
    numbers = tuple(sorted(map(int, input().split())))

    ans = float('inf')
    for x in range(n - 1):
        if numbers[x] != numbers[x + 1]: ans = min(ans, abs(numbers[x + 1] - numbers[x]))

    if ans == float('inf'): ans = 0
    print(ans)
0