結果
| 問題 |
No.1043 直列大学
|
| コンテスト | |
| ユーザー |
ayaoni
|
| 提出日時 | 2020-12-18 20:09:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,286 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 244,352 KB |
| 最終ジャッジ日時 | 2024-09-21 09:16:20 |
| 合計ジャッジ時間 | 9,434 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 4 RE * 10 |
ソースコード
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)
ayaoni