結果

問題 No.1043 直列大学
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-05-01 22:47:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 121,512 KB
最終ジャッジ日時 2023-08-24 05:51:04
合計ジャッジ時間 5,935 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
70,844 KB
testcase_01 AC 73 ms
71,300 KB
testcase_02 AC 74 ms
71,212 KB
testcase_03 AC 74 ms
71,128 KB
testcase_04 AC 73 ms
71,148 KB
testcase_05 AC 73 ms
71,232 KB
testcase_06 AC 73 ms
71,228 KB
testcase_07 AC 74 ms
71,028 KB
testcase_08 AC 75 ms
71,016 KB
testcase_09 AC 90 ms
75,876 KB
testcase_10 AC 95 ms
76,168 KB
testcase_11 AC 174 ms
81,784 KB
testcase_12 AC 383 ms
121,512 KB
testcase_13 AC 184 ms
86,508 KB
testcase_14 AC 200 ms
87,816 KB
testcase_15 AC 237 ms
95,600 KB
testcase_16 AC 187 ms
85,688 KB
testcase_17 AC 107 ms
77,096 KB
testcase_18 AC 122 ms
80,236 KB
testcase_19 AC 183 ms
88,976 KB
testcase_20 AC 106 ms
77,064 KB
testcase_21 AC 167 ms
83,396 KB
testcase_22 AC 168 ms
83,288 KB
testcase_23 AC 265 ms
99,496 KB
testcase_24 AC 140 ms
82,432 KB
testcase_25 AC 175 ms
86,492 KB
testcase_26 AC 199 ms
88,844 KB
testcase_27 AC 103 ms
76,284 KB
testcase_28 AC 110 ms
77,364 KB
testcase_29 AC 88 ms
76,124 KB
testcase_30 AC 166 ms
83,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
A, B = map(int, input().split())
sx = sum(X)+1
sy = sum(Y)+1
V = [0]*sx
V[0] = 1
for i in range(N):
    x = X[i]
    for j in range(sx-1, -1, -1):
        if j-x>=0:
            V[j] += V[j-x]
R = [0]*sy
R[0] = 1
for i in range(M):
    x = Y[i]
    for j in range(sy-1, -1, -1):
        if j-x>=0:
            R[j] += R[j-x]

SV = [0]*(sx+1)
for i in range(1, sx+1):
    SV[i] = SV[i-1] + V[i-1]

mod = 1000000007
rr = 0
for i in range(1, sy):
    r = R[i]
    a, b = min(i*A, sx), min(i*B+1, sx)
    rr = (rr+(SV[b]-SV[a])*r) % mod
#print(SV)
#print(V, R)
print(rr)
0