結果

問題 No.1279 Array Battle
ユーザー neterukunneterukun
提出日時 2020-11-06 21:27:55
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 77,176 KB
最終ジャッジ日時 2023-09-29 18:11:24
合計ジャッジ時間 3,150 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,472 KB
testcase_01 AC 66 ms
71,324 KB
testcase_02 AC 69 ms
71,324 KB
testcase_03 AC 67 ms
71,484 KB
testcase_04 AC 68 ms
71,508 KB
testcase_05 AC 67 ms
71,220 KB
testcase_06 AC 65 ms
71,216 KB
testcase_07 AC 68 ms
71,456 KB
testcase_08 AC 65 ms
71,496 KB
testcase_09 AC 66 ms
71,440 KB
testcase_10 AC 68 ms
71,480 KB
testcase_11 AC 77 ms
76,528 KB
testcase_12 AC 83 ms
76,588 KB
testcase_13 AC 100 ms
76,928 KB
testcase_14 AC 94 ms
77,020 KB
testcase_15 AC 154 ms
76,580 KB
testcase_16 AC 184 ms
77,168 KB
testcase_17 AC 180 ms
76,892 KB
testcase_18 AC 196 ms
77,176 KB
testcase_19 AC 184 ms
77,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools


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


max_ = 0
for ptn in itertools.permutations(a):
    tmp = 0
    for aa, bb in zip(ptn, b):
        tmp += max(aa - bb, 0)
    max_ = max(max_, tmp)

ans = 0
for ptn in itertools.permutations(a):
    tmp = 0
    for aa, bb in zip(ptn, b):
        tmp += max(aa - bb, 0)
    if tmp == max_:
        ans += 1
print(ans)
0