結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-31 16:42:20 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 5,000 ms |
| コード長 | 388 bytes |
| コンパイル時間 | 857 ms |
| コンパイル使用メモリ | 108,784 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 06:48:03 |
| 合計ジャッジ時間 | 1,800 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
auto n = readln.chomp.to!size_t;
auto xi = readln.split.to!(int[]);
auto calc() {
auto yi = xi.sort().uniq.array, yl = yi.length;
if (yl == 1) return 0;
auto zi = new int[](yl - 1);
foreach (i; (yl - 1).iota) zi[i] = yi[i + 1] - yi[i];
return zi.fold!min;
}
writeln(calc);
}