結果

問題 No.1043 直列大学
ユーザー titiatitia
提出日時 2020-05-01 22:39:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,197 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 186,548 KB
最終ジャッジ日時 2023-08-26 15:23:26
合計ジャッジ時間 15,295 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
85,132 KB
testcase_01 AC 112 ms
84,948 KB
testcase_02 AC 116 ms
84,980 KB
testcase_03 AC 111 ms
84,920 KB
testcase_04 AC 111 ms
84,996 KB
testcase_05 AC 111 ms
85,052 KB
testcase_06 AC 109 ms
85,268 KB
testcase_07 AC 113 ms
84,932 KB
testcase_08 AC 113 ms
84,968 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 772 ms
159,852 KB
testcase_15 AC 896 ms
164,536 KB
testcase_16 AC 750 ms
154,828 KB
testcase_17 AC 480 ms
129,008 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 353 ms
126,744 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from collections import Counter
from itertools import accumulate

N,M=map(int,input().split())
V=list(map(int,input().split()))
R=list(map(int,input().split()))
A,B=map(int,input().split())
mod=1000000007

C=Counter()
C[0]=1
for v in V:
    NC=Counter()
    for c in C:
        NC[c]=(NC[c]+C[c])%mod
        NC[c+v]=(NC[c+v]+C[c])%mod
    C=NC

C2=Counter()
C2[0]=1
for r in R:
    NC2=Counter()
    for c2 in C2:
        NC2[c2]=(NC2[c2]+C2[c2])%mod
        NC2[c2+r]=(NC2[c2+r]+C2[c2])%mod
    C2=NC2

del(C[0])
del(C2[0])

COUNT0=[0]*(10**5+1)
COUNT1=[0]*(10**5+1)

for c in C:
    COUNT0[c]=C[c]
for c2 in C2:
    COUNT1[c2]=C2[c2]

S1=list(accumulate(COUNT1))

ANS=0
r=0
for v in range(1,10**5+1):
    while r*B<v and r<=10**5:
        r+=1

    #print(v,r,ANS)
    if 0<=r-1<=10**5:
        ANS+=COUNT0[v]*(S1[-1]-S1[r-1])
    elif r==10**5+1:
        ANS+=COUNT0[v]*(S1[-1]-S1[10**5])
#print(ANS)

r=0
for v in range(1,10**5+1):
    while r*A<=v and r>=0:
        r+=1
    #print(v,r)
    if r<=10**5:
        ANS-=COUNT0[v]*(S1[-1]-S1[r-1])
    elif r==10**5+1:
        ANS-=COUNT0[v]*(S1[-1]-S1[10**5])
        
    
    
print(ANS)
        

    
0