結果

問題 No.1279 Array Battle
ユーザー maimai
提出日時 2020-11-06 21:25:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 963 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 15,692 KB
最終ジャッジ日時 2023-09-29 18:06:08
合計ジャッジ時間 7,217 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,248 KB
testcase_01 AC 75 ms
15,304 KB
testcase_02 AC 76 ms
15,324 KB
testcase_03 AC 75 ms
15,204 KB
testcase_04 AC 76 ms
15,120 KB
testcase_05 AC 77 ms
15,164 KB
testcase_06 AC 77 ms
15,124 KB
testcase_07 AC 76 ms
15,108 KB
testcase_08 AC 77 ms
15,208 KB
testcase_09 AC 76 ms
15,076 KB
testcase_10 AC 75 ms
15,260 KB
testcase_11 AC 77 ms
15,068 KB
testcase_12 AC 86 ms
15,484 KB
testcase_13 AC 164 ms
15,424 KB
testcase_14 AC 166 ms
15,188 KB
testcase_15 AC 941 ms
15,644 KB
testcase_16 AC 956 ms
15,676 KB
testcase_17 AC 956 ms
15,504 KB
testcase_18 AC 963 ms
15,692 KB
testcase_19 AC 949 ms
15,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

def lscan; gets.split.map(&:to_i); end

n = gets.to_i
aa = lscan
bb = lscan

best = -1
c = 0
aa.permutation do |ap|
  w = ap.zip(bb).map{|a,b| [a-b, 0].max }.reduce(:+)
  if best < w
    best = w
    c = 1
  elsif best == w
    c += 1
  end
end

p c
0