結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-03 16:49:15 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 254 ms / 5,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 110 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 25,344 KB |
| 最終ジャッジ日時 | 2024-06-11 06:52:48 |
| 合計ジャッジ時間 | 4,112 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
class Calc0135
def initialize(args)
args = args.map { |l| l.chomp.split(/\s+/) }
@n = args.shift.first.to_i
@xs = args.shift.map(&:to_i)
end
def run
xs = @xs.uniq
if xs.size == 1
0
else
xs.sort.each_cons(2).map { |x1, x2| x2 - x1 }.min
end
end
end
puts Calc0135.new(STDIN.readlines).run if __FILE__ == $0