結果

問題 No.1279 Array Battle
ユーザー okuramasafumiokuramasafumi
提出日時 2020-11-13 09:50:41
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 11,132 KB
実行使用メモリ 16,408 KB
最終ジャッジ日時 2023-09-30 01:56:44
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 82 ms
15,176 KB
testcase_02 WA -
testcase_03 AC 83 ms
15,292 KB
testcase_04 WA -
testcase_05 AC 83 ms
15,136 KB
testcase_06 WA -
testcase_07 AC 82 ms
15,144 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 897 ms
16,052 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, a, b = 3.times.map { gets }
n = n.to_i
a = a.split(' ').map(&:to_i)
b = b.split(' ').map(&:to_i)
count = 0
current_max_score = 0
a.sort.permutation.each do |array|
  score = 0
  n.times.map do |i|
    diff = array[i] - b[i]
    diff >= 0 ? diff : 0
  end.sum
  if score > current_max_score
    count = 1
    current_max_score = score
  elsif score == current_max_score
    count += 1
  end
end
puts count
0