結果

問題 No.1043 直列大学
ユーザー pekempeypekempey
提出日時 2020-05-01 21:55:49
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 32,004 KB
最終ジャッジ日時 2023-08-26 09:34:43
合計ジャッジ時間 15,302 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 253 ms
31,512 KB
testcase_01 AC 250 ms
31,568 KB
testcase_02 AC 262 ms
31,564 KB
testcase_03 AC 246 ms
31,596 KB
testcase_04 AC 250 ms
31,656 KB
testcase_05 AC 250 ms
31,584 KB
testcase_06 AC 246 ms
31,704 KB
testcase_07 AC 251 ms
31,616 KB
testcase_08 AC 252 ms
31,552 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 520 ms
31,560 KB
testcase_12 WA -
testcase_13 AC 491 ms
31,808 KB
testcase_14 AC 504 ms
31,592 KB
testcase_15 AC 528 ms
31,752 KB
testcase_16 AC 499 ms
31,920 KB
testcase_17 AC 434 ms
31,760 KB
testcase_18 WA -
testcase_19 AC 487 ms
31,588 KB
testcase_20 AC 423 ms
31,628 KB
testcase_21 AC 468 ms
31,564 KB
testcase_22 WA -
testcase_23 AC 531 ms
31,688 KB
testcase_24 AC 454 ms
31,692 KB
testcase_25 AC 488 ms
31,696 KB
testcase_26 AC 506 ms
31,740 KB
testcase_27 AC 369 ms
31,548 KB
testcase_28 AC 484 ms
32,004 KB
testcase_29 AC 319 ms
31,968 KB
testcase_30 AC 429 ms
31,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def input_int():
    return int(input())

def input_ints():
    return list(map(int, input().split()))

import numpy as np

MOD = 10**9 + 7

N, M = input_ints()
V = input_ints()
R = input_ints()
A, B = input_ints()

dp = np.zeros(10**5 + 10, dtype=np.int64)
dp[0] = 1
for i in range(N):
    dp[V[i]:] += dp[:-V[i]]
    dp %= MOD

ep = np.zeros(10**5 + 10, dtype=np.int64)
ep[0] = 1
for i in range(M):
    ep[R[i]:] += ep[:-R[i]]
    ep %= MOD
ep[0] = 0
ep = np.cumsum(ep)
ep %= MOD

ans = 0
for i in range(len(dp)):
    # i/B <= j <= i/A
    ans += dp[i] * ep[i // A]
    if i > 0:
        ans -= dp[i] * ep[(i + B - 1) // B - 1]
print(ans % MOD)
0