結果

問題 No.1043 直列大学
ユーザー takakintakakin
提出日時 2020-05-28 22:55:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 422 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 1,214 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 126,260 KB
最終ジャッジ日時 2023-08-24 12:49:06
合計ジャッジ時間 6,459 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,092 KB
testcase_01 AC 72 ms
70,924 KB
testcase_02 AC 70 ms
71,112 KB
testcase_03 AC 71 ms
71,348 KB
testcase_04 AC 71 ms
71,452 KB
testcase_05 AC 72 ms
71,360 KB
testcase_06 AC 71 ms
71,308 KB
testcase_07 AC 72 ms
71,140 KB
testcase_08 AC 75 ms
71,492 KB
testcase_09 AC 88 ms
75,976 KB
testcase_10 AC 94 ms
76,468 KB
testcase_11 AC 172 ms
82,572 KB
testcase_12 AC 422 ms
126,260 KB
testcase_13 AC 189 ms
88,736 KB
testcase_14 AC 202 ms
88,244 KB
testcase_15 AC 245 ms
95,976 KB
testcase_16 AC 197 ms
91,916 KB
testcase_17 AC 109 ms
78,804 KB
testcase_18 AC 124 ms
82,800 KB
testcase_19 AC 184 ms
88,604 KB
testcase_20 AC 105 ms
78,212 KB
testcase_21 AC 182 ms
91,520 KB
testcase_22 AC 174 ms
85,512 KB
testcase_23 AC 267 ms
100,608 KB
testcase_24 AC 130 ms
81,488 KB
testcase_25 AC 169 ms
85,824 KB
testcase_26 AC 200 ms
89,412 KB
testcase_27 AC 95 ms
76,404 KB
testcase_28 AC 115 ms
80,636 KB
testcase_29 AC 85 ms
76,140 KB
testcase_30 AC 189 ms
93,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
V=[int(i) for i in input().split()]
R=[int(i) for i in input().split()]
a,b=map(int,input().split())
v,r=sum(V),sum(R)
VT=[1]+[0]*v
RT=[1]+[0]*r

for i in range(n):
  for j in range(v)[::-1]:
    if j+1>=V[i]:
      VT[j+1]+=VT[j+1-V[i]]
for i in range(m):
  for j in range(r)[::-1]:
    if j+1>=R[i]:
      RT[j+1]+=RT[j+1-R[i]]
VTT=[0]
for i in range(v+1):
  VTT.append(VTT[-1]+VT[i])

mod=10**9+7
ans=0
for i in range(r+1):
  ans+=(VTT[min(v+1,i*b+1)]-VTT[min(v+1,i*a)])*RT[i]
  if ans>mod:
    ans%=mod
print(ans-1)
  
0