結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2016-05-16 13:56:44 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 482 bytes |
コンパイル時間 | 883 ms |
コンパイル使用メモリ | 104,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 03:30:12 |
合計ジャッジ時間 | 1,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 22 |
ソースコード
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, before; ans = arr[1] - arr[0]; foreach(i, x; arr){ if(before == x || i == 0) continue; if(ans > x - before){ ans = x - before; } before = x; } writeln(ans); }