結果

問題 No.406 鴨等間隔の法則
ユーザー wotsushiwotsushi
提出日時 2017-04-24 19:09:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 11,208 KB
実行使用メモリ 23,620 KB
最終ジャッジ日時 2023-09-21 18:26:15
合計ジャッジ時間 5,332 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
18,164 KB
testcase_01 AC 76 ms
15,212 KB
testcase_02 AC 78 ms
15,088 KB
testcase_03 AC 76 ms
15,004 KB
testcase_04 AC 128 ms
22,464 KB
testcase_05 AC 97 ms
17,664 KB
testcase_06 AC 97 ms
17,860 KB
testcase_07 AC 98 ms
17,836 KB
testcase_08 AC 123 ms
22,356 KB
testcase_09 AC 136 ms
23,412 KB
testcase_10 AC 100 ms
18,328 KB
testcase_11 AC 118 ms
21,588 KB
testcase_12 AC 106 ms
19,116 KB
testcase_13 AC 102 ms
18,976 KB
testcase_14 AC 130 ms
21,904 KB
testcase_15 AC 79 ms
15,520 KB
testcase_16 AC 80 ms
15,460 KB
testcase_17 AC 78 ms
15,320 KB
testcase_18 AC 79 ms
15,548 KB
testcase_19 AC 80 ms
15,336 KB
testcase_20 AC 83 ms
15,976 KB
testcase_21 AC 81 ms
15,908 KB
testcase_22 AC 90 ms
16,724 KB
testcase_23 AC 107 ms
19,552 KB
testcase_24 AC 125 ms
20,832 KB
testcase_25 AC 139 ms
23,448 KB
testcase_26 AC 148 ms
23,540 KB
testcase_27 AC 128 ms
23,300 KB
testcase_28 AC 128 ms
23,620 KB
testcase_29 AC 149 ms
23,456 KB
testcase_30 AC 146 ms
23,216 KB
testcase_31 AC 136 ms
23,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
x = gets.split.map(&:to_i)
y = x.sort
d = y[1] - y[0]
ans = if d > 0 and (0...(N - 1)).all? {|i| y[i + 1] - y[i] == d}
        "YES"
      else
        "NO"
      end
puts ans
0