結果

問題 No.406 鴨等間隔の法則
ユーザー kou_kkk
提出日時 2024-02-26 21:30:06
言語 Nim
(2.2.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 3,306 ms
コンパイル使用メモリ 65,988 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-09-29 11:45:43
合計ジャッジ時間 5,312 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import algorithm, sequtils, strutils

let
  n = parseInt readLine stdin
  xs = stdin
         .readLine
         .split
         .map(parseBiggestInt)
         .sorted
         .deduplicate(true)

if xs.len < n:
  echo "NO"
  quit()

let
  d = xs[1] - xs[0]

for i in 1..<xs.len:
  if xs[i] - xs[i.pred] != d:
    echo "NO"
    quit()

echo "YES"
0