結果

問題 No.1279 Array Battle
ユーザー universato
提出日時 2020-12-08 19:04:43
言語 Ruby
(3.4.1)
結果
AC  
実行時間 391 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-09-17 20:05:23
合計ジャッジ時間 4,412 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_s.to_i
a = gets.to_s.split.map(&:to_i)
b = gets.to_s.split.map(&:to_i)

m = 0
ans = 0
a.permutation do |a|
  s = 0
  i = 0
  while i < n
    d = a[i] - b[i]
    s += d if d > 0
    i += 1
  end
  if s > m
    ans = 1
    m = s
  elsif s == m
    ans += 1
  end
end

puts ans
0