結果

問題 No.135 とりあえず1次元の問題
ユーザー kokatsu
提出日時 2022-09-13 21:29:32
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 2,496 ms
コンパイル使用メモリ 214,104 KB
実行使用メモリ 7,704 KB
最終ジャッジ日時 2024-06-22 16:13:36
合計ジャッジ時間 3,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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