結果

問題 No.1279 Array Battle
ユーザー rlangevin
提出日時 2023-02-05 21:45:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 76,556 KB
最終ジャッジ日時 2024-07-04 07:32:30
合計ジャッジ時間 2,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from collections import *

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans, maxv = 0, -1
D = defaultdict(int)
for tup in permutations(A):
    v = 0
    for i in range(N):
        v += max(0, tup[i] - B[i])
    D[v] += 1

for k, v in D.items():
    if k > maxv:
        ans = v
        maxv = k
print(ans)
0