結果

問題 No.1279 Array Battle
ユーザー okuramasafumiokuramasafumi
提出日時 2020-11-11 22:27:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 11,352 KB
実行使用メモリ 19,860 KB
最終ジャッジ日時 2023-09-30 00:55:58
合計ジャッジ時間 5,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,108 KB
testcase_01 AC 80 ms
15,184 KB
testcase_02 AC 81 ms
15,200 KB
testcase_03 AC 81 ms
15,300 KB
testcase_04 AC 79 ms
15,140 KB
testcase_05 AC 77 ms
15,268 KB
testcase_06 AC 78 ms
15,112 KB
testcase_07 AC 80 ms
15,356 KB
testcase_08 AC 79 ms
15,152 KB
testcase_09 AC 79 ms
15,260 KB
testcase_10 AC 78 ms
15,072 KB
testcase_11 AC 80 ms
15,384 KB
testcase_12 AC 84 ms
15,668 KB
testcase_13 AC 126 ms
16,092 KB
testcase_14 AC 123 ms
15,900 KB
testcase_15 AC 507 ms
19,832 KB
testcase_16 AC 517 ms
19,832 KB
testcase_17 AC 515 ms
19,860 KB
testcase_18 AC 514 ms
19,820 KB
testcase_19 AC 523 ms
19,720 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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