結果

問題 No.1279 Array Battle
ユーザー hiragnhiragn
提出日時 2022-11-23 10:15:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,081 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 11,760 KB
実行使用メモリ 10,212 KB
最終ジャッジ日時 2023-10-24 20:56:45
合計ジャッジ時間 7,050 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,036 KB
testcase_01 AC 29 ms
10,036 KB
testcase_02 AC 27 ms
10,036 KB
testcase_03 AC 26 ms
10,036 KB
testcase_04 AC 26 ms
10,036 KB
testcase_05 AC 26 ms
10,036 KB
testcase_06 AC 26 ms
10,036 KB
testcase_07 AC 26 ms
10,036 KB
testcase_08 AC 26 ms
10,036 KB
testcase_09 AC 26 ms
10,036 KB
testcase_10 AC 26 ms
10,036 KB
testcase_11 AC 28 ms
10,036 KB
testcase_12 AC 37 ms
10,036 KB
testcase_13 AC 130 ms
10,056 KB
testcase_14 AC 129 ms
10,036 KB
testcase_15 AC 936 ms
10,036 KB
testcase_16 AC 955 ms
10,036 KB
testcase_17 AC 1,081 ms
10,132 KB
testcase_18 AC 1,077 ms
10,212 KB
testcase_19 AC 1,066 ms
10,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
from collections import defaultdict


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

    d = defaultdict(int)
    for aa in permutations(a):
        tot = 0
        for i in range(n):
            tot += max(aa[i] - b[i], 0)
        d[tot] += 1
    print(d[max(d)])


if __name__ == "__main__":
    main()
0