結果

問題 No.406 鴨等間隔の法則
ユーザー yozayoza
提出日時 2016-08-05 22:51:13
言語 Ruby
(3.3.0)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 26,756 KB
最終ジャッジ日時 2023-09-21 17:46:41
合計ジャッジ時間 5,120 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
19,484 KB
testcase_01 AC 75 ms
15,152 KB
testcase_02 AC 75 ms
15,088 KB
testcase_03 AC 75 ms
15,140 KB
testcase_04 AC 135 ms
21,584 KB
testcase_05 AC 105 ms
18,604 KB
testcase_06 AC 101 ms
18,996 KB
testcase_07 AC 101 ms
19,040 KB
testcase_08 AC 137 ms
21,760 KB
testcase_09 AC 149 ms
26,344 KB
testcase_10 AC 104 ms
19,432 KB
testcase_11 AC 129 ms
21,164 KB
testcase_12 AC 110 ms
20,956 KB
testcase_13 AC 108 ms
20,356 KB
testcase_14 AC 138 ms
21,468 KB
testcase_15 AC 80 ms
15,460 KB
testcase_16 AC 82 ms
15,516 KB
testcase_17 AC 79 ms
15,288 KB
testcase_18 AC 80 ms
15,660 KB
testcase_19 AC 90 ms
15,640 KB
testcase_20 AC 85 ms
16,164 KB
testcase_21 AC 84 ms
16,260 KB
testcase_22 AC 91 ms
16,552 KB
testcase_23 AC 114 ms
21,068 KB
testcase_24 AC 132 ms
21,192 KB
testcase_25 AC 149 ms
26,500 KB
testcase_26 AC 156 ms
26,756 KB
testcase_27 AC 143 ms
26,632 KB
testcase_28 AC 138 ms
26,648 KB
testcase_29 AC 157 ms
26,564 KB
testcase_30 AC 162 ms
26,452 KB
testcase_31 AC 147 ms
26,176 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
x_list = gets.split.map(&:to_i)

x_list.sort!

f_diff = x_list[1] - x_list[0]

ok = x_list[1..-2].zip(x_list[2..-1]).all? do |l, h|
  h - l == f_diff
end

ok = false if f_diff == 0

puts ok ? 'YES' : 'NO'
0