結果

問題 No.1279 Array Battle
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-11-06 21:25:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,660 KB
最終ジャッジ日時 2023-09-29 18:06:15
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,292 KB
testcase_01 AC 73 ms
71,636 KB
testcase_02 AC 69 ms
71,632 KB
testcase_03 AC 70 ms
71,496 KB
testcase_04 AC 73 ms
71,556 KB
testcase_05 AC 70 ms
71,368 KB
testcase_06 AC 71 ms
71,452 KB
testcase_07 AC 71 ms
71,504 KB
testcase_08 AC 71 ms
71,292 KB
testcase_09 AC 70 ms
71,456 KB
testcase_10 AC 72 ms
71,116 KB
testcase_11 AC 77 ms
76,132 KB
testcase_12 AC 79 ms
76,124 KB
testcase_13 AC 87 ms
76,104 KB
testcase_14 AC 84 ms
76,164 KB
testcase_15 AC 116 ms
76,388 KB
testcase_16 AC 121 ms
76,380 KB
testcase_17 AC 119 ms
76,512 KB
testcase_18 AC 120 ms
76,348 KB
testcase_19 AC 119 ms
76,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

maxi = 0
ans  = 0

for x in itertools.permutations(A,N):

    now = 0
    cnt = 0
    for i in x:
        if i > B[cnt]:
            now += i-B[cnt]
        cnt += 1

    if now == maxi:
        ans += 1
    elif now > maxi:
        maxi = now
        ans  = 1

print (ans)
0