結果

問題 No.1279 Array Battle
ユーザー okuramasafumiokuramasafumi
提出日時 2020-11-12 15:34:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 11,452 KB
実行使用メモリ 16,808 KB
最終ジャッジ日時 2023-09-30 01:15:56
合計ジャッジ時間 5,134 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 85 ms
15,032 KB
testcase_02 WA -
testcase_03 AC 83 ms
15,156 KB
testcase_04 WA -
testcase_05 AC 84 ms
15,072 KB
testcase_06 WA -
testcase_07 AC 84 ms
15,136 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 569 ms
16,736 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.permutation.each do |array|
  score = 0
  n.times do |i|
    diff = array[i] - b[i]
    score << diff if diff >= 0
  end
  if score > current_max_score
    count = 1
    current_max_score = score
  elsif score == current_max_score
    count += 1
  end
end
puts count
0