結果

問題 No.1279 Array Battle
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-14 05:57:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-29 10:09:30
合計ジャッジ時間 3,387 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,760 KB
testcase_01 AC 42 ms
53,504 KB
testcase_02 AC 41 ms
54,272 KB
testcase_03 AC 40 ms
53,632 KB
testcase_04 AC 42 ms
53,760 KB
testcase_05 AC 42 ms
53,888 KB
testcase_06 AC 41 ms
53,668 KB
testcase_07 AC 43 ms
53,376 KB
testcase_08 AC 41 ms
53,504 KB
testcase_09 AC 45 ms
53,248 KB
testcase_10 AC 42 ms
54,400 KB
testcase_11 AC 59 ms
67,584 KB
testcase_12 AC 89 ms
76,416 KB
testcase_13 AC 112 ms
76,800 KB
testcase_14 AC 107 ms
76,544 KB
testcase_15 AC 289 ms
76,316 KB
testcase_16 AC 284 ms
76,644 KB
testcase_17 AC 322 ms
77,148 KB
testcase_18 AC 301 ms
77,312 KB
testcase_19 AC 297 ms
77,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=[0]
dic=defaultdict(int)

def  cal(x,total,ff):
    if x == n:
        ans[0] = max(ans[0],total)
        dic[total] += 1
        return
    
    for i in range(n):    
        if str(i) in ff:
            continue
        t = max(a[x]-b[i],0)
        
        cal(x+1,total+t,ff+str(i))


f=''
cal(0,0,f)
#print(ans[0])
print(dic[ans[0]])
0