結果

問題 No.1279 Array Battle
ユーザー terrafarmterrafarm
提出日時 2020-11-22 20:23:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,699 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 51,028 KB
最終ジャッジ日時 2023-09-30 23:03:21
合計ジャッジ時間 10,361 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,144 KB
testcase_01 AC 17 ms
8,120 KB
testcase_02 AC 16 ms
8,300 KB
testcase_03 AC 16 ms
8,108 KB
testcase_04 AC 15 ms
8,156 KB
testcase_05 AC 15 ms
8,108 KB
testcase_06 AC 16 ms
8,116 KB
testcase_07 AC 15 ms
8,092 KB
testcase_08 AC 16 ms
8,216 KB
testcase_09 AC 16 ms
8,268 KB
testcase_10 AC 16 ms
8,232 KB
testcase_11 AC 17 ms
8,288 KB
testcase_12 AC 34 ms
8,740 KB
testcase_13 AC 190 ms
12,960 KB
testcase_14 AC 180 ms
13,108 KB
testcase_15 AC 1,566 ms
50,884 KB
testcase_16 AC 1,611 ms
51,028 KB
testcase_17 AC 1,699 ms
51,012 KB
testcase_18 AC 1,676 ms
50,880 KB
testcase_19 AC 1,691 ms
51,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
seq = list(permutations(a))
ans = 0
max_score = 0
for se in seq:
    score = 0
    for i in range(n):
        score += max(0, se[i] - b[i])
    if score > max_score:
        max_score = score
        ans = 1
    elif score == max_score:
        ans += 1
print(ans)
0