結果

問題 No.155 生放送とBGM
ユーザー vwxyzvwxyz
提出日時 2021-09-24 21:21:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 761 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 26,228 KB
最終ジャッジ日時 2023-09-18 20:29:12
合計ジャッジ時間 14,656 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
readline=sys.stdin.readline

N,L=map(int,readline().split())
L*=60
S=[]
for s in readline().split():
    mm,ss=map(int,s.split(":"))
    S.append(mm*60+ss)
dp=[[0]*18001 for i in range(N+1)]
dp[0][0]=1
ans=0
S_sum=sum(S)
if L>=S_sum:
    ans=N
else:
    for s in S:
        for i in range(N,0,-1):
            for j in range(18000,s-1,-1):
                dp[i][j]+=dp[i-1][j-s]
    for s in S:
        dp_=[[dp[i][j] for j in range(18001)] for i in range(N+1)]
        for i in range(1,N+1):
            for j in range(s,18001):
                dp_[i][j]-=dp_[i-1][j-s]
        for i in range(N):
            for j in range(L):
                ans+=math.factorial(i)*dp_[i][j]*math.factorial(N-i-1)
    ans/=math.factorial(N)
print(ans)
0