結果

問題 No.135 とりあえず1次元の問題
ユーザー 0tofu0tofu
提出日時 2015-02-10 21:13:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 152 ms / 5,000 ms
コード長 223 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2023-09-01 02:54:27
合計ジャッジ時間 3,485 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
23,116 KB
testcase_01 AC 76 ms
15,340 KB
testcase_02 AC 77 ms
15,364 KB
testcase_03 AC 83 ms
15,244 KB
testcase_04 AC 78 ms
15,084 KB
testcase_05 AC 79 ms
15,260 KB
testcase_06 AC 80 ms
15,292 KB
testcase_07 AC 78 ms
15,140 KB
testcase_08 AC 78 ms
15,340 KB
testcase_09 AC 79 ms
15,156 KB
testcase_10 AC 80 ms
15,296 KB
testcase_11 AC 79 ms
15,160 KB
testcase_12 AC 79 ms
15,128 KB
testcase_13 AC 78 ms
15,028 KB
testcase_14 AC 79 ms
15,028 KB
testcase_15 AC 78 ms
15,084 KB
testcase_16 AC 81 ms
15,040 KB
testcase_17 AC 78 ms
15,124 KB
testcase_18 AC 79 ms
15,144 KB
testcase_19 AC 80 ms
15,028 KB
testcase_20 AC 79 ms
15,260 KB
testcase_21 AC 135 ms
23,296 KB
testcase_22 AC 152 ms
23,084 KB
evil01.txt AC 145 ms
23,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

x.sort!

ans = 0
(n-1).times do |i|
  if x[i] != x[i + 1]
    ans_wk = (x[i] - x[i + 1]).abs
    if ans == 0 || ans_wk < ans
      ans = ans_wk
    end
  end
end

puts ans
0