結果

問題 No.1279 Array Battle
ユーザー brthyyjpbrthyyjp
提出日時 2020-11-06 21:27:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 77,340 KB
最終ジャッジ日時 2023-09-29 18:09:46
合計ジャッジ時間 3,658 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,552 KB
testcase_01 AC 74 ms
71,540 KB
testcase_02 AC 70 ms
71,544 KB
testcase_03 AC 70 ms
71,480 KB
testcase_04 AC 71 ms
71,156 KB
testcase_05 AC 70 ms
71,388 KB
testcase_06 AC 70 ms
71,456 KB
testcase_07 AC 70 ms
71,536 KB
testcase_08 AC 70 ms
71,392 KB
testcase_09 AC 74 ms
71,532 KB
testcase_10 AC 72 ms
71,300 KB
testcase_11 AC 85 ms
76,472 KB
testcase_12 AC 90 ms
76,196 KB
testcase_13 AC 106 ms
77,136 KB
testcase_14 AC 105 ms
76,976 KB
testcase_15 AC 156 ms
76,720 KB
testcase_16 AC 200 ms
76,876 KB
testcase_17 AC 192 ms
77,168 KB
testcase_18 AC 207 ms
77,340 KB
testcase_19 AC 199 ms
77,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

M = 0
import itertools
for p in itertools.permutations(A, n):
    temp = 0
    for a, b in zip(p, B):
        temp += max(0, a-b)
    M = max(temp, M)

ans = 0
for p in itertools.permutations(A, n):
    temp = 0
    for a, b in zip(p, B):
        temp += max(0, a-b)
    if temp == M:
        ans += 1
print(ans)
0