結果

問題 No.1279 Array Battle
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-11-07 17:45:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 89,320 KB
最終ジャッジ日時 2023-09-29 20:41:10
合計ジャッジ時間 2,944 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,532 KB
testcase_01 AC 68 ms
71,544 KB
testcase_02 AC 67 ms
71,476 KB
testcase_03 AC 66 ms
71,492 KB
testcase_04 AC 65 ms
71,396 KB
testcase_05 AC 68 ms
71,548 KB
testcase_06 AC 64 ms
71,568 KB
testcase_07 AC 63 ms
71,628 KB
testcase_08 AC 64 ms
71,392 KB
testcase_09 AC 63 ms
71,540 KB
testcase_10 AC 64 ms
71,544 KB
testcase_11 AC 70 ms
76,540 KB
testcase_12 AC 74 ms
76,432 KB
testcase_13 AC 81 ms
78,360 KB
testcase_14 AC 80 ms
78,532 KB
testcase_15 AC 120 ms
89,320 KB
testcase_16 AC 133 ms
89,052 KB
testcase_17 AC 137 ms
89,044 KB
testcase_18 AC 135 ms
89,304 KB
testcase_19 AC 135 ms
89,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse=True)
b.sort()
l = []
for i in itertools.permutations(range(n)):
    cost = 0
    for j,x in enumerate(i):
        if a[x] > b[j]:
            cost += a[x]-b[j]
    l.append(cost)
print(l.count(max(l)))
0