結果

問題 No.406 鴨等間隔の法則
ユーザー shi-moshi-mo
提出日時 2016-08-31 21:39:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 184 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 11,484 KB
実行使用メモリ 23,648 KB
最終ジャッジ日時 2023-09-21 18:04:51
合計ジャッジ時間 5,258 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
18,420 KB
testcase_01 AC 82 ms
15,080 KB
testcase_02 AC 81 ms
15,032 KB
testcase_03 AC 82 ms
15,092 KB
testcase_04 AC 131 ms
22,628 KB
testcase_05 AC 102 ms
17,744 KB
testcase_06 AC 101 ms
17,840 KB
testcase_07 AC 102 ms
18,000 KB
testcase_08 AC 128 ms
22,456 KB
testcase_09 AC 144 ms
23,552 KB
testcase_10 AC 106 ms
18,348 KB
testcase_11 AC 125 ms
21,512 KB
testcase_12 AC 109 ms
19,108 KB
testcase_13 AC 108 ms
19,024 KB
testcase_14 AC 135 ms
21,692 KB
testcase_15 AC 83 ms
15,524 KB
testcase_16 AC 85 ms
15,428 KB
testcase_17 AC 85 ms
15,424 KB
testcase_18 AC 83 ms
15,280 KB
testcase_19 AC 87 ms
15,536 KB
testcase_20 AC 90 ms
15,900 KB
testcase_21 AC 88 ms
15,844 KB
testcase_22 AC 96 ms
16,744 KB
testcase_23 AC 113 ms
19,704 KB
testcase_24 AC 129 ms
21,016 KB
testcase_25 AC 144 ms
23,644 KB
testcase_26 AC 155 ms
23,648 KB
testcase_27 AC 131 ms
23,460 KB
testcase_28 AC 132 ms
23,540 KB
testcase_29 AC 154 ms
23,624 KB
testcase_30 AC 154 ms
23,324 KB
testcase_31 AC 142 ms
22,924 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

d = x[1] - x[0]
n.times do |i|
  next if i < 2
  if x[i] == x[i-1] || (x[i] - x[i-1]) != d
    puts 'NO'
    exit 0
  end
end
puts 'YES'
0