結果

問題 No.1279 Array Battle
ユーザー kyo1kyo1
提出日時 2020-11-07 02:51:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,079 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 8,308 KB
最終ジャッジ日時 2023-09-29 20:07:34
合計ジャッジ時間 6,683 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,212 KB
testcase_01 AC 14 ms
8,124 KB
testcase_02 AC 14 ms
8,296 KB
testcase_03 AC 15 ms
8,144 KB
testcase_04 AC 16 ms
8,292 KB
testcase_05 AC 16 ms
8,124 KB
testcase_06 AC 15 ms
8,248 KB
testcase_07 AC 14 ms
8,124 KB
testcase_08 AC 14 ms
8,292 KB
testcase_09 AC 14 ms
8,136 KB
testcase_10 AC 15 ms
8,252 KB
testcase_11 AC 17 ms
8,128 KB
testcase_12 AC 28 ms
8,292 KB
testcase_13 AC 122 ms
8,240 KB
testcase_14 AC 116 ms
8,296 KB
testcase_15 AC 1,011 ms
8,172 KB
testcase_16 AC 997 ms
8,308 KB
testcase_17 AC 1,052 ms
8,296 KB
testcase_18 AC 1,079 ms
8,168 KB
testcase_19 AC 1,066 ms
8,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

A = sorted(A, reverse=True)
B = sorted(B)

M = sum([max(0, a - b) for a, b in zip(A, B)])

res = 0
for lis in itertools.permutations(A):
    if sum([max(0, a - b) for a, b in zip(lis, B)]) == M:
        res += 1

print(res)
0