結果

問題 No.1279 Array Battle
ユーザー qib
提出日時 2022-11-16 23:50:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 77,016 KB
最終ジャッジ日時 2024-09-17 18:19:04
合計ジャッジ時間 2,713 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import itertools as it

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = defaultdict(int)
for ap in it.permutations(a, n):
  s = sum(max(0, ap[i] - b[i]) for i in range(n))
  cnt[s] += 1

x = max(list(cnt.keys()))
print(cnt[x])
0