結果

問題 No.406 鴨等間隔の法則
ユーザー te-sh
提出日時 2017-10-25 11:59:34
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 107,348 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 22:05:39
合計ジャッジ時間 3,528 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto x = readln.split.to!(int[]);

  x.sort();

  auto y = new int[](n-1);
  foreach (i; 0..n-1) y[i] = x[i+1] - x[i];

  writeln(y[0] > 0 && y.uniq.walkLength == 1 ? "YES" : "NO");
}
0