結果

問題 No.135 とりあえず1次元の問題
ユーザー kokatsukokatsu
提出日時 2022-09-13 21:29:32
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 210,640 KB
実行使用メモリ 7,568 KB
最終ジャッジ日時 2023-09-04 18:21:47
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
7,452 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 19 ms
7,568 KB
testcase_22 AC 34 ms
7,468 KB
evil01.txt AC 29 ms
7,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    auto X = readln.chomp.split.to!(int[]);

    X.sort;

    auto U = X.uniq.array;
    auto len = U.length;

    int res;
    foreach (i; 1 .. len) {
        if (res == 0) res = U[i] - U[i-1];
        else res = min(res, U[i]-U[i-1]);
    }

    res.writeln;
}
0