結果
問題 |
No.1279 Array Battle
|
ユーザー |
![]() |
提出日時 | 2022-01-14 05:57:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 288 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,204 KB |
実行使用メモリ | 77,364 KB |
最終ジャッジ日時 | 2024-11-18 12:46:36 |
合計ジャッジ時間 | 3,046 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
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]])