結果

問題 No.1279 Array Battle
ユーザー gorugo30
提出日時 2021-01-06 13:33:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,392 KB
最終ジャッジ日時 2024-11-06 23:08:23
合計ジャッジ時間 2,521 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
P = [i for i in range(N)]

maxpoint = 0
maxcount = 0
for p in permutations(P):
    point = 0
    j = 0
    for i in p:
        point += max(0, A[i] - B[j])
        j += 1
    if point > maxpoint:
        maxpoint = point
        maxcount = 1
    elif point == maxpoint:
        maxcount += 1
print(maxcount)
0