結果

問題 No.1279 Array Battle
ユーザー ktachibanaktachibana
提出日時 2020-11-11 19:41:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 599 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 11,552 KB
実行使用メモリ 16,820 KB
最終ジャッジ日時 2023-09-30 00:50:15
合計ジャッジ時間 5,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,160 KB
testcase_01 AC 83 ms
15,152 KB
testcase_02 AC 81 ms
15,064 KB
testcase_03 AC 80 ms
15,036 KB
testcase_04 AC 80 ms
15,264 KB
testcase_05 AC 84 ms
15,068 KB
testcase_06 AC 81 ms
15,152 KB
testcase_07 AC 80 ms
15,176 KB
testcase_08 AC 80 ms
15,156 KB
testcase_09 AC 81 ms
15,284 KB
testcase_10 AC 83 ms
15,300 KB
testcase_11 AC 82 ms
15,268 KB
testcase_12 AC 87 ms
15,464 KB
testcase_13 AC 133 ms
16,020 KB
testcase_14 AC 135 ms
16,008 KB
testcase_15 AC 572 ms
16,588 KB
testcase_16 AC 589 ms
16,820 KB
testcase_17 AC 599 ms
16,684 KB
testcase_18 AC 591 ms
16,696 KB
testcase_19 AC 590 ms
16,492 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

io = STDIN
io.gets
aa = io.gets.split(' ').map(&:to_i)
ba = io.gets.split(' ').map(&:to_i)

max_point = 0
max_point_count = 0
aa.permutation do |a_seq|
  sum = 0
  a_seq.zip(ba) do |a, b|
    point = a - b
    sum += point if point.positive?
  end
  if max_point < sum
    max_point = sum
    max_point_count = 1
  elsif max_point == sum
    max_point_count += 1
  end
end
puts max_point_count
0