結果
問題 | No.1043 直列大学 |
ユーザー |
![]() |
提出日時 | 2022-01-13 00:31:30 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 871 bytes |
コンパイル時間 | 509 ms |
コンパイル使用メモリ | 82,076 KB |
実行使用メモリ | 181,136 KB |
最終ジャッジ日時 | 2024-11-15 18:29:00 |
合計ジャッジ時間 | 12,716 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 RE * 1 |
ソースコード
import collectionsimport itertoolsN,M = map(int, input().split())V = list(map(int, input().split()))R = list(map(int, input().split()))A,B = map(int, input().split())mod = 10**9+7DPV = collections.defaultdict(int)DPR = collections.defaultdict(int)DPV[0]=1DPR[0]=1for a in V:NDPV = collections.defaultdict(int)for k,v in DPV.items():NDPV[k+a]=(v+NDPV[k+a])%modNDPV[k]=(v+NDPV[k])%modDPV = NDPVfor a in R:NDPR = collections.defaultdict(int)for k,v in DPR.items():NDPR[k+a]=(v+NDPR[k+a])%modNDPR[k]=(v+NDPR[k])%modDPR = NDPRRS = [0]*1000*(M+1)for k,v in DPR.items():RS[k]=vRAC = list(itertools.accumulate(RS))ans = 0for k,v in DPV.items():if k>0:ma = k//Ami = -(-k//B)ans = (ans+(RAC[min(ma,len(RAC))]-RAC[min(mi-1,len(RAC))])*v)%modprint(ans)