結果

問題 No.135 とりあえず1次元の問題
ユーザー バカらっくバカらっく
提出日時 2018-02-18 16:00:36
言語 Swift
(5.10.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 295 bytes
コンパイル時間 1,316 ms
コンパイル使用メモリ 137,028 KB
実行使用メモリ 15,144 KB
最終ジャッジ日時 2024-05-07 17:13:51
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
15,128 KB
testcase_01 AC 7 ms
9,216 KB
testcase_02 AC 8 ms
9,216 KB
testcase_03 AC 7 ms
9,216 KB
testcase_04 AC 7 ms
9,216 KB
testcase_05 AC 7 ms
9,216 KB
testcase_06 AC 7 ms
9,472 KB
testcase_07 AC 7 ms
9,216 KB
testcase_08 AC 7 ms
9,216 KB
testcase_09 AC 8 ms
9,216 KB
testcase_10 AC 7 ms
9,216 KB
testcase_11 AC 7 ms
9,344 KB
testcase_12 AC 7 ms
9,344 KB
testcase_13 AC 7 ms
9,216 KB
testcase_14 AC 8 ms
9,344 KB
testcase_15 AC 7 ms
9,216 KB
testcase_16 AC 8 ms
9,344 KB
testcase_17 AC 9 ms
9,216 KB
testcase_18 AC 8 ms
9,344 KB
testcase_19 AC 9 ms
9,216 KB
testcase_20 AC 8 ms
9,344 KB
testcase_21 AC 64 ms
14,520 KB
testcase_22 AC 71 ms
15,144 KB
evil01.txt AC 68 ms
14,940 KB
権限があれば一括ダウンロードができます

ソースコード

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