結果

問題 No.406 鴨等間隔の法則
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-01-29 22:59:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 215 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 27,776 KB
最終ジャッジ日時 2023-09-21 19:12:24
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
19,920 KB
testcase_01 AC 77 ms
15,136 KB
testcase_02 AC 76 ms
15,148 KB
testcase_03 AC 76 ms
15,360 KB
testcase_04 AC 134 ms
26,172 KB
testcase_05 AC 99 ms
19,196 KB
testcase_06 AC 101 ms
19,668 KB
testcase_07 AC 102 ms
19,700 KB
testcase_08 AC 131 ms
25,880 KB
testcase_09 AC 147 ms
27,628 KB
testcase_10 AC 103 ms
19,804 KB
testcase_11 AC 126 ms
24,640 KB
testcase_12 AC 110 ms
21,192 KB
testcase_13 AC 106 ms
20,836 KB
testcase_14 AC 140 ms
25,180 KB
testcase_15 AC 80 ms
15,348 KB
testcase_16 AC 82 ms
15,712 KB
testcase_17 AC 81 ms
15,548 KB
testcase_18 AC 81 ms
15,896 KB
testcase_19 AC 82 ms
15,920 KB
testcase_20 AC 86 ms
16,352 KB
testcase_21 AC 85 ms
16,376 KB
testcase_22 AC 93 ms
17,528 KB
testcase_23 AC 111 ms
21,408 KB
testcase_24 AC 133 ms
24,228 KB
testcase_25 AC 144 ms
27,496 KB
testcase_26 AC 160 ms
27,776 KB
testcase_27 AC 128 ms
25,128 KB
testcase_28 AC 133 ms
27,528 KB
testcase_29 AC 161 ms
27,620 KB
testcase_30 AC 158 ms
27,496 KB
testcase_31 AC 143 ms
27,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
x = gets.chomp.split.map(&:to_i).sort

if x.uniq.size < n
  puts 'NO'
  exit
end

sub = (x[1] - x[0]).abs
x.each_cons(2) do |a, b|
  next if (b - a).abs == sub

  puts 'NO'
  exit
end

puts 'YES'
0