結果

問題 No.1279 Array Battle
ユーザー AzumabashiAzumabashi
提出日時 2020-11-08 13:06:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,067 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 10,508 KB
実行使用メモリ 8,708 KB
最終ジャッジ日時 2023-09-29 21:10:27
合計ジャッジ時間 6,718 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,644 KB
testcase_01 AC 15 ms
8,472 KB
testcase_02 AC 15 ms
8,504 KB
testcase_03 AC 15 ms
8,456 KB
testcase_04 AC 16 ms
8,600 KB
testcase_05 AC 15 ms
8,564 KB
testcase_06 AC 15 ms
8,440 KB
testcase_07 AC 17 ms
8,572 KB
testcase_08 AC 16 ms
8,456 KB
testcase_09 AC 15 ms
8,612 KB
testcase_10 AC 15 ms
8,496 KB
testcase_11 AC 17 ms
8,472 KB
testcase_12 AC 28 ms
8,568 KB
testcase_13 AC 124 ms
8,668 KB
testcase_14 AC 122 ms
8,456 KB
testcase_15 AC 990 ms
8,604 KB
testcase_16 AC 1,015 ms
8,484 KB
testcase_17 AC 1,058 ms
8,692 KB
testcase_18 AC 1,067 ms
8,704 KB
testcase_19 AC 1,067 ms
8,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
from collections import defaultdict


def main():
    n = int(input())
    a = [int(k) for k in input().split()]
    b = [int(k) for k in input().split()]
    cnt = defaultdict(int)
    idx = 0
    for p in permutations(b):
        score = sum([max(aa - bb, 0) for aa, bb in zip(a, p)])
        cnt[score] += 1
        idx = max(idx, score)
    print(cnt[idx])


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