結果

問題 No.1043 直列大学
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-06 20:31:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 243,736 KB
最終ジャッジ日時 2023-08-24 12:53:57
合計ジャッジ時間 9,911 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
91,240 KB
testcase_01 AC 95 ms
85,676 KB
testcase_02 AC 120 ms
94,324 KB
testcase_03 AC 94 ms
85,744 KB
testcase_04 AC 96 ms
85,972 KB
testcase_05 AC 104 ms
87,288 KB
testcase_06 AC 101 ms
87,360 KB
testcase_07 AC 109 ms
89,624 KB
testcase_08 AC 113 ms
91,204 KB
testcase_09 AC 259 ms
164,128 KB
testcase_10 AC 288 ms
180,968 KB
testcase_11 AC 352 ms
229,736 KB
testcase_12 AC 403 ms
243,736 KB
testcase_13 AC 333 ms
216,584 KB
testcase_14 AC 360 ms
224,452 KB
testcase_15 AC 385 ms
237,636 KB
testcase_16 AC 353 ms
221,160 KB
testcase_17 AC 283 ms
184,336 KB
testcase_18 AC 304 ms
184,796 KB
testcase_19 AC 336 ms
214,940 KB
testcase_20 AC 291 ms
184,084 KB
testcase_21 AC 321 ms
204,756 KB
testcase_22 AC 337 ms
208,288 KB
testcase_23 AC 382 ms
243,332 KB
testcase_24 AC 301 ms
194,744 KB
testcase_25 AC 335 ms
214,972 KB
testcase_26 AC 361 ms
223,684 KB
testcase_27 AC 233 ms
153,996 KB
testcase_28 AC 345 ms
214,516 KB
testcase_29 AC 187 ms
127,320 KB
testcase_30 AC 288 ms
183,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = sys.stdin.buffer.readline

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

M = 10**5+50
SV = [0]*M
SR = [0]*M

SV[0] = 1
for v in V:
    temp = [0]*M
    for i in range(M):
        temp[i] = SV[i]
    for i in range(M):
        if i+v < M:
            temp[i+v] += SV[i]
            temp[i+v] %= mod
    SV = temp
SR[0] = 1
for r in R:
    temp = [0]*M
    for i in range(M):
        temp[i] = SR[i]
    for i in range(M):
        if i+r < M:
            temp[i+r] += SR[i]
            temp[i+r] %= mod
    SR = temp

from itertools import accumulate
cum = SV
cum = list(accumulate(cum))
ans = 0
for i in range(1, M):
    c = SR[i]
    l = a*i
    r = b*i
    ans += (cum[min(r, M-1)]-cum[min(l-1, M-1)])*c
    ans %= mod
print(ans)
0