結果

問題 No.1043 直列大学
ユーザー pekempeypekempey
提出日時 2020-05-01 21:54:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 31,924 KB
最終ジャッジ日時 2023-08-26 09:29:51
合計ジャッジ時間 13,159 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 219 ms
31,540 KB
testcase_01 AC 220 ms
31,552 KB
testcase_02 AC 235 ms
31,760 KB
testcase_03 AC 221 ms
31,604 KB
testcase_04 AC 228 ms
31,756 KB
testcase_05 AC 224 ms
31,744 KB
testcase_06 AC 230 ms
31,848 KB
testcase_07 AC 223 ms
31,640 KB
testcase_08 AC 228 ms
31,676 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 472 ms
31,816 KB
testcase_12 WA -
testcase_13 AC 451 ms
31,924 KB
testcase_14 AC 454 ms
31,628 KB
testcase_15 AC 477 ms
31,680 KB
testcase_16 AC 454 ms
31,716 KB
testcase_17 AC 395 ms
31,632 KB
testcase_18 WA -
testcase_19 AC 432 ms
31,672 KB
testcase_20 AC 377 ms
31,608 KB
testcase_21 AC 417 ms
31,736 KB
testcase_22 WA -
testcase_23 AC 480 ms
31,724 KB
testcase_24 AC 393 ms
31,636 KB
testcase_25 AC 421 ms
31,548 KB
testcase_26 AC 458 ms
31,752 KB
testcase_27 AC 331 ms
31,736 KB
testcase_28 AC 662 ms
31,732 KB
testcase_29 AC 283 ms
31,728 KB
testcase_30 AC 374 ms
31,852 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)

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