結果

問題 No.1279 Array Battle
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-14 05:57:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 79,620 KB
最終ジャッジ日時 2023-08-11 18:45:20
合計ジャッジ時間 5,616 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,416 KB
testcase_01 AC 95 ms
71,652 KB
testcase_02 AC 97 ms
71,740 KB
testcase_03 AC 97 ms
71,416 KB
testcase_04 AC 96 ms
71,248 KB
testcase_05 AC 96 ms
71,596 KB
testcase_06 AC 95 ms
71,744 KB
testcase_07 AC 97 ms
71,480 KB
testcase_08 AC 96 ms
71,248 KB
testcase_09 AC 97 ms
71,604 KB
testcase_10 AC 97 ms
71,476 KB
testcase_11 AC 114 ms
77,540 KB
testcase_12 AC 142 ms
78,216 KB
testcase_13 AC 168 ms
78,640 KB
testcase_14 AC 161 ms
78,424 KB
testcase_15 AC 359 ms
78,272 KB
testcase_16 AC 370 ms
78,956 KB
testcase_17 AC 405 ms
79,376 KB
testcase_18 AC 393 ms
79,620 KB
testcase_19 AC 380 ms
78,740 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