結果

問題 No.1279 Array Battle
ユーザー tamura2004tamura2004
提出日時 2021-01-22 19:27:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 960 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 11,512 KB
実行使用メモリ 15,620 KB
最終ジャッジ日時 2023-08-27 15:17:39
合計ジャッジ時間 7,999 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,248 KB
testcase_01 AC 81 ms
15,144 KB
testcase_02 AC 81 ms
15,344 KB
testcase_03 AC 81 ms
15,148 KB
testcase_04 AC 82 ms
15,300 KB
testcase_05 AC 82 ms
15,100 KB
testcase_06 AC 82 ms
15,112 KB
testcase_07 AC 81 ms
15,148 KB
testcase_08 AC 82 ms
15,096 KB
testcase_09 AC 81 ms
15,304 KB
testcase_10 AC 81 ms
15,096 KB
testcase_11 AC 84 ms
15,044 KB
testcase_12 AC 92 ms
15,380 KB
testcase_13 AC 171 ms
15,524 KB
testcase_14 AC 168 ms
15,272 KB
testcase_15 AC 909 ms
15,496 KB
testcase_16 AC 941 ms
15,468 KB
testcase_17 AC 958 ms
15,500 KB
testcase_18 AC 960 ms
15,620 KB
testcase_19 AC 951 ms
15,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_s.to_i
a = gets.to_s.split.map { |v| v.to_i }
b = gets.to_s.split.map { |v| v.to_i }
cnt = Hash.new(0)
a.permutation do |a|
  key = a.zip(b).map { |i, j| i > j ? i - j : 0 }.sum
  cnt[key] += 1
end
ans = cnt[cnt.keys.max]
puts ans
0