結果

問題 No.1279 Array Battle
ユーザー okuramasafumi
提出日時 2020-11-11 22:27:46
言語 Ruby
(3.4.1)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2024-07-22 18:52:52
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

_, a, b = 3.times.map { gets }
a = a.split(' ').map(&:to_i)
b = b.split(' ').map(&:to_i)
scores = a.permutation.each_with_object([]) do |array, ss|
  score = 0
  array.size.times do |i|
    diff = array[i] - b[i]
    score += diff if diff >= 0
  end
  ss << score
end
max_score = scores.max
puts(scores.count {|s| s == max_score})
0