結果

問題 No.406 鴨等間隔の法則
コンテスト
ユーザー mkanenobu
提出日時 2018-03-20 20:00:07
言語 Nim
(2.2.8)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 457 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,739 ms
コンパイル使用メモリ 69,060 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2026-03-19 23:08:40
合計ジャッジ時間 59,118 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sequtils, strutils, algorithm

var
    n = readLine(stdin).parseInt
    x = readLine(stdin).split.map(parseInt)
x = x.map(proc(y:int):int = y - min(x))
sort(x, cmp[int])
proc main():string =
    if len(x) != len(deduplicate(x)):
        return "NO"
    var m = x[1] - x[0]
    for i,v in x:
        if i <= 1:
            continue
        if v - x[i - 1] == m:
            continue
        else:
            return "NO"
    return "YES"

echo main()
0