結果

問題 No.135 とりあえず1次元の問題
ユーザー kiridaruma
提出日時 2016-05-16 13:51:35
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 03:30:10
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
import core.stdc.stdlib;

void main(){
    auto s = readln.strip.to!int;
    int[] arr = readln.strip.split.map!(to!int).array;
    if(s == 1){0.writeln;exit(-1);}
    arr.sort;
    int ans = int.max, before;
    foreach(i, x; arr){
        if(i == 0) continue;
        if(ans > arr[i] - before){
            ans = arr[i] - before;
        }
        before = arr[i];
    }
    writeln(ans != 0 ? ans : 1);
}
0