結果

問題 No.1279 Array Battle
ユーザー えいじえいじ
提出日時 2023-10-06 19:05:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,188 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 8,300 KB
最終ジャッジ日時 2023-10-06 19:06:07
合計ジャッジ時間 7,247 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,132 KB
testcase_01 AC 15 ms
8,140 KB
testcase_02 AC 15 ms
8,108 KB
testcase_03 AC 16 ms
8,184 KB
testcase_04 AC 16 ms
8,228 KB
testcase_05 AC 15 ms
8,096 KB
testcase_06 AC 15 ms
8,140 KB
testcase_07 AC 15 ms
8,184 KB
testcase_08 AC 15 ms
8,228 KB
testcase_09 AC 16 ms
8,300 KB
testcase_10 AC 16 ms
8,188 KB
testcase_11 AC 17 ms
8,164 KB
testcase_12 AC 27 ms
8,296 KB
testcase_13 AC 124 ms
8,100 KB
testcase_14 AC 97 ms
8,272 KB
testcase_15 AC 662 ms
8,272 KB
testcase_16 AC 1,005 ms
8,128 KB
testcase_17 AC 1,188 ms
8,236 KB
testcase_18 AC 1,108 ms
8,276 KB
testcase_19 AC 1,151 ms
8,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
max_sco = 0
cnt = 0
for ID in itertools.permutations(range(N)):
    sco = 0
    for i in range(N):
        if A[ID[i]] > B[i]:
            sco += A[ID[i]] - B[i]
    if max_sco < sco:
        max_sco = sco
        cnt = 1
    elif max_sco == sco:
        cnt += 1
print(cnt)
0