結果

問題 No.1043 直列大学
ユーザー titia
提出日時 2020-05-01 21:53:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 338,844 KB
最終ジャッジ日時 2024-12-25 03:46:50
合計ジャッジ時間 50,852 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from collections import Counter
C=Counter()
C[0]=1
for v in V:
    NC=Counter()
    for c in C:
        NC[c]+=C[c]
        NC[c+v]+=C[c]
    C=NC

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

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

ANS=0
for c in C:
    for c2 in C2:
        if A*c2<=c<=B*c2:
            ANS+=C[c]*C2[c2]
print(ANS%1000000007)
        

    
0