結果

問題 No.1043 直列大学
ユーザー amyuamyu
提出日時 2020-05-01 22:03:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 799 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 28,368 KB
最終ジャッジ日時 2023-08-26 13:33:35
合計ジャッジ時間 5,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
13,876 KB
testcase_01 AC 53 ms
9,488 KB
testcase_02 AC 50 ms
9,456 KB
testcase_03 AC 53 ms
9,444 KB
testcase_04 AC 53 ms
9,384 KB
testcase_05 AC 53 ms
9,484 KB
testcase_06 AC 53 ms
9,404 KB
testcase_07 AC 52 ms
9,520 KB
testcase_08 AC 51 ms
9,448 KB
testcase_09 AC 108 ms
13,160 KB
testcase_10 AC 172 ms
14,068 KB
testcase_11 AC 229 ms
13,832 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,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+7
import collections
V=collections.defaultdict(int)
R=collections.defaultdict(int)
V[0]=1
R[0]=1
for i in v:
    d=V.copy()
    for j in d.keys():
        V[j+i]+=d[j]
        V[j+i]%=mod
for i in r:
    d=R.copy()
    for j in d.keys():
        R[j+i]+=d[j]
        R[j+i]%=mod

Vkumi=[0 for i in range(100001)]
del V[0]
del R[0]

for i,j in V.items():
    Vkumi[i]=j
for i in range(1,100001):
    Vkumi[i]+=Vkumi[i-1]
    Vkumi[i]%=mod

ans=0
for i,j in R.items():
    if i*a>10**5:
        continue
    elif i*b>10**5:
        ans+=(Vkumi[-1]-Vkumi[i*a-1])*j%mod
        ans%=mod
    else:
        ans+=(Vkumi[i*b]-Vkumi[i*a-1])*j%mod
        ans%=mod
print(ans)
0