結果

問題 No.135 とりあえず1次元の問題
ユーザー iwamotiwamot
提出日時 2016-01-21 00:31:15
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 212 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 25,900 KB
最終ジャッジ日時 2023-09-01 23:11:27
合計ジャッジ時間 4,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
25,900 KB
testcase_01 AC 82 ms
15,056 KB
testcase_02 AC 83 ms
15,164 KB
testcase_03 AC 82 ms
15,096 KB
testcase_04 AC 83 ms
15,056 KB
testcase_05 AC 83 ms
15,056 KB
testcase_06 AC 83 ms
15,164 KB
testcase_07 AC 82 ms
15,088 KB
testcase_08 AC 81 ms
15,236 KB
testcase_09 AC 81 ms
15,060 KB
testcase_10 AC 80 ms
15,340 KB
testcase_11 AC 82 ms
15,060 KB
testcase_12 AC 81 ms
15,280 KB
testcase_13 AC 83 ms
15,288 KB
testcase_14 AC 81 ms
15,204 KB
testcase_15 AC 81 ms
15,280 KB
testcase_16 AC 81 ms
15,292 KB
testcase_17 AC 81 ms
15,200 KB
testcase_18 AC 80 ms
15,344 KB
testcase_19 AC 83 ms
15,164 KB
testcase_20 AC 81 ms
15,200 KB
testcase_21 WA -
testcase_22 AC 160 ms
25,700 KB
evil01.txt AC 152 ms
25,820 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 = 999999
(size - 1).downto(1) do |i|
  d = (xs[i] - xs[i - 1]).abs
  a = d if a > d
end

puts a
0