結果

問題 No.1043 直列大学
ユーザー takakintakakin
提出日時 2020-05-28 22:54:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 21,912 KB
最終ジャッジ日時 2024-04-21 14:05:31
合計ジャッジ時間 7,685 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
16,256 KB
testcase_01 AC 33 ms
10,624 KB
testcase_02 AC 34 ms
10,880 KB
testcase_03 AC 32 ms
10,624 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 33 ms
10,624 KB
testcase_07 AC 34 ms
10,880 KB
testcase_08 AC 34 ms
10,880 KB
testcase_09 AC 171 ms
11,136 KB
testcase_10 AC 418 ms
11,648 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

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