結果

問題 No.1279 Array Battle
ユーザー HAGI_TAROHAGI_TARO
提出日時 2021-10-06 09:21:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 78,876 KB
最終ジャッジ日時 2023-09-30 08:38:48
合計ジャッジ時間 5,168 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,444 KB
testcase_01 AC 74 ms
71,300 KB
testcase_02 AC 79 ms
75,288 KB
testcase_03 AC 74 ms
71,488 KB
testcase_04 AC 80 ms
71,656 KB
testcase_05 AC 76 ms
71,488 KB
testcase_06 AC 75 ms
71,512 KB
testcase_07 AC 74 ms
71,308 KB
testcase_08 AC 75 ms
71,492 KB
testcase_09 AC 78 ms
71,520 KB
testcase_10 AC 82 ms
75,492 KB
testcase_11 AC 107 ms
76,308 KB
testcase_12 AC 152 ms
78,256 KB
testcase_13 AC 169 ms
77,956 KB
testcase_14 AC 179 ms
78,280 KB
testcase_15 AC 441 ms
77,772 KB
testcase_16 AC 507 ms
78,672 KB
testcase_17 AC 530 ms
78,876 KB
testcase_18 AC 492 ms
78,252 KB
testcase_19 AC 469 ms
78,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mx = -1
for p in permutations(A):
    mx = max(mx, sum(max(0, x-y) for x,y in zip(p, B)))
cnt = 0
for p in permutations(A):
    cnt += sum(max(0, x-y) for x,y in zip(p, B)) == mx
print(cnt)
0