結果

問題 No.1279 Array Battle
ユーザー Azumabashi
提出日時 2020-11-08 13:06:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,426 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-22 15:05:51
合計ジャッジ時間 8,473 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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