結果

問題 No.1279 Array Battle
ユーザー TomoyarnTomoyarn
提出日時 2022-02-01 05:52:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 77,712 KB
最終ジャッジ日時 2023-09-02 02:27:41
合計ジャッジ時間 4,161 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,424 KB
testcase_01 AC 69 ms
71,316 KB
testcase_02 AC 72 ms
71,316 KB
testcase_03 AC 69 ms
71,416 KB
testcase_04 AC 68 ms
71,332 KB
testcase_05 AC 69 ms
71,528 KB
testcase_06 AC 69 ms
71,148 KB
testcase_07 AC 67 ms
71,296 KB
testcase_08 AC 67 ms
71,444 KB
testcase_09 AC 69 ms
71,456 KB
testcase_10 AC 71 ms
71,504 KB
testcase_11 AC 81 ms
76,244 KB
testcase_12 AC 100 ms
77,584 KB
testcase_13 AC 123 ms
77,712 KB
testcase_14 AC 114 ms
77,288 KB
testcase_15 AC 219 ms
77,452 KB
testcase_16 AC 277 ms
77,428 KB
testcase_17 AC 259 ms
77,552 KB
testcase_18 AC 253 ms
77,648 KB
testcase_19 AC 230 ms
77,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def solve(N, a, b):
    junretsu = itertools.permutations(a, N)
    cnt = 0
    saidai = 0
    for x in junretsu:
        total = sum(max(x[i] - b[i], 0) for i in range(N))
        if total > saidai:
            saidai = total
            cnt = 1
        elif total == saidai:
            cnt += 1

    return cnt


N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

print(solve(N, a, b))
0