結果

問題 No.135 とりあえず1次元の問題
ユーザー バカらっく
提出日時 2018-02-18 16:00:36
言語 Swift
(6.0.3)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 295 bytes
コンパイル時間 1,593 ms
コンパイル使用メモリ 137,028 KB
実行使用メモリ 14,624 KB
最終ジャッジ日時 2024-11-30 11:52:30
合計ジャッジ時間 2,544 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

let pointCount = Int(readLine()!);

let points = readLine()!.split(separator: " ").map({Int($0)!}).sorted(by: {$0<$1});

var ans = abs(points.first!-points.last!);

for i in 1...points.count-1 {
    let tmp = points[i]-points[i-1];
    if(tmp>0) {
        ans=min(ans, tmp);
    }
}
print(ans);
0