結果

問題 No.1043 直列大学
ユーザー ayaoniayaoni
提出日時 2020-12-18 20:09:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,286 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,380 KB
実行使用メモリ 243,260 KB
最終ジャッジ日時 2023-10-21 08:14:56
合計ジャッジ時間 10,535 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
78,324 KB
testcase_01 AC 60 ms
73,104 KB
testcase_02 AC 91 ms
85,116 KB
testcase_03 AC 61 ms
73,112 KB
testcase_04 AC 62 ms
73,104 KB
testcase_05 AC 65 ms
76,748 KB
testcase_06 AC 66 ms
76,740 KB
testcase_07 AC 75 ms
78,356 KB
testcase_08 AC 78 ms
79,916 KB
testcase_09 AC 266 ms
160,156 KB
testcase_10 WA -
testcase_11 AC 426 ms
214,732 KB
testcase_12 AC 550 ms
243,260 KB
testcase_13 RE -
testcase_14 AC 352 ms
195,520 KB
testcase_15 RE -
testcase_16 AC 380 ms
206,468 KB
testcase_17 AC 271 ms
159,580 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 435 ms
231,980 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 164 ms
116,872 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import accumulate
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M = MI()
V,R = [0]+LI(),[0]+LI()
A,B = MI()
mod = 10**9+7

V_count = [[0]*100001 for _ in range(N+1)]
V_count[0][0] = 1
for i in range(1,N+1):
    v = V[i]
    for j in range(100001):
        V_count[i][j] = V_count[i-1][j]
        if j >= v:
            V_count[i][j] += V_count[i-1][j-v]
            V_count[i][j] %= mod

A_V_count = list(accumulate(V_count[-1]))

R_count = [[0]*100001 for _ in range(N+1)]
R_count[0][0] = 1
for i in range(1,N+1):
    r = R[i]
    for j in range(100001):
        R_count[i][j] = R_count[i-1][j]
        if j >= r:
            R_count[i][j] += R_count[i-1][j-r]
            R_count[i][j] %= mod

ans = 0
for i in range(1,100001):
    if A*i > 100000:
        break
    ans += R_count[-1][i]*(A_V_count[min(100000,B*i)]-A_V_count[A*i-1])
    ans %= mod

print(ans)
0