結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2017-01-31 16:41:43 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 876 ms |
コンパイル使用メモリ | 108,476 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 06:47:53 |
合計ジャッジ時間 | 1,979 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
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 -1; auto zi = new int[](yl - 1); foreach (i; (yl - 1).iota) zi[i] = yi[i + 1] - yi[i]; return zi.fold!min; } writeln(calc); }