結果

問題 No.135 とりあえず1次元の問題
ユーザー nbisco
提出日時 2016-03-23 21:11:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 23,716 KB
最終ジャッジ日時 2025-01-03 14:28:22
合計ジャッジ時間 2,812 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#fileencoding: utf-8

N = int(input())
X = sorted(list(set([int(i) for i in input().strip().split(" ")])))
N = len(X)

dmin = 10e10
nocount = 0
for i in range(N-1):
    for j in range(i+1,N):
        if X[i] == X[j]:
            nocount += 1
            continue
        tmp = abs(X[i]-X[j])
        if tmp > dmin:
            break
        else:
            dmin = abs(X[i]-X[j])

if nocount == N*(N-1)//2:
    print(0)
else:
    print(dmin)
0