結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
31,700 KB
testcase_01 AC 214 ms
31,728 KB
testcase_02 AC 224 ms
31,596 KB
testcase_03 AC 216 ms
31,652 KB
testcase_04 AC 221 ms
31,612 KB
testcase_05 AC 224 ms
31,744 KB
testcase_06 AC 215 ms
31,816 KB
testcase_07 AC 221 ms
31,760 KB
testcase_08 AC 224 ms
31,644 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 460 ms
31,668 KB
testcase_12 WA -
testcase_13 AC 444 ms
31,684 KB
testcase_14 AC 451 ms
31,688 KB
testcase_15 AC 469 ms
31,720 KB
testcase_16 AC 457 ms
31,724 KB
testcase_17 AC 392 ms
32,012 KB
testcase_18 WA -
testcase_19 AC 434 ms
31,636 KB
testcase_20 AC 382 ms
31,796 KB
testcase_21 AC 409 ms
31,596 KB
testcase_22 WA -
testcase_23 AC 479 ms
31,680 KB
testcase_24 AC 400 ms
31,572 KB
testcase_25 AC 436 ms
31,688 KB
testcase_26 AC 458 ms
31,708 KB
testcase_27 AC 333 ms
31,708 KB
testcase_28 AC 657 ms
31,724 KB
testcase_29 AC 280 ms
31,744 KB
testcase_30 AC 379 ms
31,892 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 = 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]
ans -= 1
print(ans % MOD)
0