結果

問題 No.406 鴨等間隔の法則
ユーザー fshutofshuto
提出日時 2019-04-18 08:34:45
言語 Ruby
(3.3.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 185 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 23,676 KB
最終ジャッジ日時 2023-09-21 19:01:08
合計ジャッジ時間 5,892 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
18,352 KB
testcase_01 AC 81 ms
15,048 KB
testcase_02 AC 81 ms
15,180 KB
testcase_03 AC 79 ms
15,276 KB
testcase_04 AC 129 ms
22,424 KB
testcase_05 AC 99 ms
17,772 KB
testcase_06 AC 99 ms
18,020 KB
testcase_07 AC 100 ms
18,168 KB
testcase_08 AC 127 ms
22,556 KB
testcase_09 AC 140 ms
23,352 KB
testcase_10 AC 103 ms
18,264 KB
testcase_11 AC 121 ms
21,476 KB
testcase_12 AC 108 ms
19,104 KB
testcase_13 AC 107 ms
19,152 KB
testcase_14 AC 133 ms
21,736 KB
testcase_15 AC 82 ms
15,416 KB
testcase_16 AC 83 ms
15,384 KB
testcase_17 AC 83 ms
15,348 KB
testcase_18 AC 84 ms
15,408 KB
testcase_19 AC 86 ms
15,412 KB
testcase_20 AC 86 ms
15,752 KB
testcase_21 AC 84 ms
15,980 KB
testcase_22 AC 92 ms
16,736 KB
testcase_23 AC 110 ms
19,504 KB
testcase_24 AC 129 ms
20,904 KB
testcase_25 AC 142 ms
23,420 KB
testcase_26 AC 154 ms
23,676 KB
testcase_27 AC 131 ms
23,340 KB
testcase_28 AC 131 ms
23,432 KB
testcase_29 AC 154 ms
23,440 KB
testcase_30 AC 153 ms
23,200 KB
testcase_31 AC 141 ms
23,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
xs = gets.split.map(&:to_i).sort
diff = xs[1] - xs[0]
(0..N-2).each do |i|
  if xs[i+1] - xs[i] != diff || xs[i+1] - xs[i] == 0
    puts 'NO'
    exit
  end
end
puts 'YES'
0