結果

問題 No.1043 直列大学
ユーザー tanon710tanon710
提出日時 2020-05-04 01:24:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 381 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 117,816 KB
最終ジャッジ日時 2023-08-24 12:45:31
合計ジャッジ時間 7,126 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
75,836 KB
testcase_01 AC 75 ms
71,404 KB
testcase_02 AC 81 ms
76,116 KB
testcase_03 AC 75 ms
71,288 KB
testcase_04 AC 74 ms
71,276 KB
testcase_05 AC 73 ms
71,120 KB
testcase_06 AC 78 ms
71,404 KB
testcase_07 AC 81 ms
75,912 KB
testcase_08 AC 82 ms
75,756 KB
testcase_09 AC 109 ms
77,544 KB
testcase_10 AC 126 ms
79,372 KB
testcase_11 AC 258 ms
87,840 KB
testcase_12 AC 381 ms
117,816 KB
testcase_13 AC 240 ms
94,120 KB
testcase_14 AC 256 ms
95,568 KB
testcase_15 AC 325 ms
104,544 KB
testcase_16 AC 230 ms
91,668 KB
testcase_17 AC 116 ms
77,588 KB
testcase_18 AC 141 ms
83,756 KB
testcase_19 AC 230 ms
93,560 KB
testcase_20 AC 115 ms
77,776 KB
testcase_21 AC 215 ms
89,992 KB
testcase_22 AC 214 ms
91,200 KB
testcase_23 AC 359 ms
107,904 KB
testcase_24 AC 149 ms
83,180 KB
testcase_25 AC 200 ms
85,568 KB
testcase_26 AC 265 ms
95,556 KB
testcase_27 AC 106 ms
77,404 KB
testcase_28 AC 205 ms
88,832 KB
testcase_29 AC 93 ms
77,024 KB
testcase_30 AC 199 ms
89,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n,m=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
a,b=map(int,input().split())
dp1=[0]*(1000*n+1)
dp1[0]=1
dp2=[0]*(1000*m+1)
dp2[0]=1
for i in range(n):
    for j in range(1000*n,arr1[i]-1,-1):
        dp1[j]+=dp1[j-arr1[i]]
for i in range(1,1000*n+1):
    dp1[i]+=dp1[i-1]
for i in range(m):
    for j in range(1000*m,arr2[i]-1,-1):
        dp2[j]+=dp2[j-arr2[i]]
ans=0
for i in range(1,1000*m+1):
    ans+=dp2[i]*(dp1[min(b*i,1000*n)]-dp1[min(a*i-1,1000*n)])
    ans%=mod
print(ans)
0