結果

問題 No.1043 直列大学
ユーザー titiatitia
提出日時 2020-05-01 21:53:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 14,968 KB
最終ジャッジ日時 2023-08-26 09:24:56
合計ジャッジ時間 6,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,896 KB
testcase_01 AC 16 ms
8,476 KB
testcase_02 AC 16 ms
8,468 KB
testcase_03 AC 16 ms
8,508 KB
testcase_04 AC 16 ms
8,556 KB
testcase_05 AC 15 ms
8,504 KB
testcase_06 AC 16 ms
8,568 KB
testcase_07 AC 17 ms
8,492 KB
testcase_08 AC 15 ms
8,512 KB
testcase_09 TLE -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
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 #

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