結果

問題 No.406 鴨等間隔の法則
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2018-02-01 00:41:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 11,260 KB
実行使用メモリ 29,252 KB
最終ジャッジ日時 2023-09-21 18:43:14
合計ジャッジ時間 5,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
19,472 KB
testcase_01 AC 87 ms
15,040 KB
testcase_02 AC 77 ms
15,088 KB
testcase_03 AC 78 ms
15,176 KB
testcase_04 AC 118 ms
24,948 KB
testcase_05 AC 95 ms
18,748 KB
testcase_06 AC 96 ms
18,784 KB
testcase_07 AC 96 ms
19,052 KB
testcase_08 AC 117 ms
24,780 KB
testcase_09 AC 129 ms
25,804 KB
testcase_10 AC 98 ms
19,524 KB
testcase_11 AC 114 ms
23,688 KB
testcase_12 AC 104 ms
20,376 KB
testcase_13 AC 100 ms
20,328 KB
testcase_14 AC 157 ms
24,248 KB
testcase_15 AC 81 ms
15,300 KB
testcase_16 AC 85 ms
15,804 KB
testcase_17 AC 83 ms
15,516 KB
testcase_18 AC 85 ms
15,920 KB
testcase_19 AC 86 ms
15,736 KB
testcase_20 AC 89 ms
16,440 KB
testcase_21 AC 89 ms
16,848 KB
testcase_22 AC 96 ms
17,156 KB
testcase_23 AC 102 ms
20,848 KB
testcase_24 AC 144 ms
23,056 KB
testcase_25 AC 128 ms
25,964 KB
testcase_26 AC 174 ms
29,248 KB
testcase_27 AC 122 ms
22,968 KB
testcase_28 AC 126 ms
25,880 KB
testcase_29 AC 173 ms
29,252 KB
testcase_30 AC 172 ms
29,152 KB
testcase_31 AC 129 ms
25,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

unless x.length == x.uniq.length
  puts 'NO'
  exit
end

sorted_x = x.sort

satisfy = sorted_x[0..-2].zip(sorted_x[1..-1]).map { |a, b|
  (b - a).abs
}.uniq.size == 1

puts satisfy ? 'YES' : 'NO'
0