結果

問題 No.1043 直列大学
ユーザー AEnAEn
提出日時 2022-05-20 10:56:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,008 ms / 2,000 ms
コード長 826 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 409,084 KB
最終ジャッジ日時 2023-10-19 22:23:39
合計ジャッジ時間 12,767 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
73,352 KB
testcase_01 AC 50 ms
69,504 KB
testcase_02 AC 66 ms
78,088 KB
testcase_03 AC 50 ms
69,504 KB
testcase_04 AC 50 ms
69,504 KB
testcase_05 AC 49 ms
69,504 KB
testcase_06 AC 49 ms
69,504 KB
testcase_07 AC 61 ms
74,952 KB
testcase_08 AC 60 ms
74,952 KB
testcase_09 AC 207 ms
153,016 KB
testcase_10 AC 246 ms
176,488 KB
testcase_11 AC 594 ms
305,136 KB
testcase_12 AC 989 ms
409,084 KB
testcase_13 AC 598 ms
299,512 KB
testcase_14 AC 653 ms
301,880 KB
testcase_15 AC 869 ms
366,952 KB
testcase_16 AC 604 ms
284,200 KB
testcase_17 AC 255 ms
170,404 KB
testcase_18 AC 273 ms
182,392 KB
testcase_19 AC 578 ms
285,256 KB
testcase_20 AC 261 ms
174,908 KB
testcase_21 AC 552 ms
273,552 KB
testcase_22 AC 532 ms
265,008 KB
testcase_23 AC 1,008 ms
388,428 KB
testcase_24 AC 332 ms
193,296 KB
testcase_25 AC 478 ms
250,956 KB
testcase_26 AC 677 ms
303,132 KB
testcase_27 AC 197 ms
141,988 KB
testcase_28 AC 436 ms
250,228 KB
testcase_29 AC 130 ms
111,528 KB
testcase_30 AC 445 ms
237,040 KB
権限があれば一括ダウンロードができます

ソースコード

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())

dp = [[0]*(10**5+1) for _ in range(N)]
dp1 = [[0]*(10**5+1) for _ in range(M)]
dp[0][0] = 1;dp[0][V[0]] = 1
dp1[0][0] = 1;dp1[0][R[0]] = 1
for i in range(1, N):
    for j in range(10**5+1):
        dp[i][j] += dp[i-1][j] 
        if dp[i-1][j] > 0:
            dp[i][j+V[i]] += dp[i-1][j]
for i in range(1, M):
    for j in range(10**5+1):
        dp1[i][j] += dp1[i-1][j] 
        if dp1[i-1][j] > 0:
            dp1[i][j+R[i]] += dp1[i-1][j]
from itertools import accumulate
VV = list(accumulate(dp[-1]))
res = 0
mod = 10**9+7
for i in range(1,len(dp1[-1])):
    if dp1[-1][i] > 0 and A*i<=10**5:
        res += (VV[min(10**5, B*i)] - VV[A*i-1])*dp1[-1][i]
        res %= mod
print(res)
0