結果

問題 No.135 とりあえず1次元の問題
ユーザー iwamotiwamot
提出日時 2016-01-21 00:43:27
言語 Ruby
(3.2.2)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 213 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 25,936 KB
最終ジャッジ日時 2023-09-01 23:11:37
合計ジャッジ時間 3,706 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
25,724 KB
testcase_01 AC 80 ms
15,300 KB
testcase_02 AC 84 ms
15,332 KB
testcase_03 AC 80 ms
15,136 KB
testcase_04 AC 81 ms
15,104 KB
testcase_05 AC 80 ms
15,344 KB
testcase_06 AC 80 ms
15,216 KB
testcase_07 AC 81 ms
15,228 KB
testcase_08 AC 82 ms
15,284 KB
testcase_09 AC 80 ms
15,200 KB
testcase_10 AC 81 ms
15,224 KB
testcase_11 AC 81 ms
15,260 KB
testcase_12 AC 80 ms
15,292 KB
testcase_13 AC 79 ms
15,060 KB
testcase_14 AC 81 ms
15,140 KB
testcase_15 AC 78 ms
15,144 KB
testcase_16 AC 81 ms
15,180 KB
testcase_17 AC 80 ms
15,260 KB
testcase_18 AC 82 ms
15,248 KB
testcase_19 AC 80 ms
15,196 KB
testcase_20 AC 80 ms
15,228 KB
testcase_21 AC 133 ms
23,612 KB
testcase_22 AC 160 ms
25,936 KB
evil01.txt AC 153 ms
25,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
xs = gets.split(' ').map(&:to_i)

xs.sort!.uniq!
size = xs.size
if size <= 1
  puts 0
  exit
end

a = 9999999999
(size - 1).downto(1) do |i|
  d = (xs[i] - xs[i - 1]).abs
  a = d if a > d
end

puts a
0