結果

問題 No.1279 Array Battle
ユーザー chineristACchineristAC
提出日時 2020-11-06 21:24:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 77,432 KB
最終ジャッジ日時 2023-09-29 18:03:56
合計ジャッジ時間 3,365 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,516 KB
testcase_01 AC 71 ms
71,432 KB
testcase_02 AC 74 ms
71,356 KB
testcase_03 AC 72 ms
71,292 KB
testcase_04 AC 72 ms
71,116 KB
testcase_05 AC 72 ms
71,284 KB
testcase_06 AC 70 ms
71,628 KB
testcase_07 AC 71 ms
71,336 KB
testcase_08 AC 71 ms
71,640 KB
testcase_09 AC 69 ms
71,332 KB
testcase_10 AC 70 ms
71,436 KB
testcase_11 AC 85 ms
76,856 KB
testcase_12 AC 86 ms
76,424 KB
testcase_13 AC 104 ms
76,948 KB
testcase_14 AC 100 ms
77,216 KB
testcase_15 AC 156 ms
77,080 KB
testcase_16 AC 194 ms
77,160 KB
testcase_17 AC 188 ms
77,432 KB
testcase_18 AC 203 ms
77,280 KB
testcase_19 AC 192 ms
77,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

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

res = 0
p = [i for i in range(N)]
L = permutations(p)

for p in L:
    tmp = 0
    for i in range(N):
        tmp += max(0,a[p[i]]-b[i])
    res = max(res,tmp)

ans = 0
L = permutations(p)
for p in L:
    tmp = 0
    for i in range(N):
        tmp += max(0,a[p[i]]-b[i])
    ans += (tmp==res)

print(ans)
0