結果

問題 No.1279 Array Battle
ユーザー lloyzlloyz
提出日時 2022-01-30 01:27:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 77,052 KB
最終ジャッジ日時 2023-09-01 03:18:38
合計ジャッジ時間 3,564 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,328 KB
testcase_01 AC 72 ms
71,368 KB
testcase_02 AC 73 ms
71,488 KB
testcase_03 AC 72 ms
71,520 KB
testcase_04 AC 72 ms
71,172 KB
testcase_05 AC 72 ms
71,560 KB
testcase_06 AC 71 ms
71,496 KB
testcase_07 AC 72 ms
71,516 KB
testcase_08 AC 73 ms
71,372 KB
testcase_09 AC 70 ms
71,492 KB
testcase_10 AC 70 ms
71,492 KB
testcase_11 AC 78 ms
76,296 KB
testcase_12 AC 81 ms
76,656 KB
testcase_13 AC 88 ms
76,328 KB
testcase_14 AC 85 ms
76,640 KB
testcase_15 AC 115 ms
77,032 KB
testcase_16 AC 136 ms
76,844 KB
testcase_17 AC 125 ms
77,016 KB
testcase_18 AC 131 ms
77,052 KB
testcase_19 AC 126 ms
77,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

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

max_n = 0
ans = 0
for P in permutations(range(n)):
    res = 0
    for i in range(n):
        if A[P[i]] >= B[i]:
            res += A[P[i]] - B[i]
    if res > max_n:
        max_n = res
        ans = 1
    elif res == max_n:
        ans += 1
print(ans)
0