結果

問題 No.155 生放送とBGM
ユーザー vwxyzvwxyz
提出日時 2021-09-24 21:46:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 689 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 54,700 KB
最終ジャッジ日時 2023-09-18 21:06:46
合計ジャッジ時間 15,312 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 sys
readline=sys.stdin.readline
import numpy as np

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)
ans=0
S_sum=sum(S)
if L>=S_sum:
    ans=N
else:
    fact=np.zeros(51)
    fact[0]=1.0
    for i in range(1,51):
        fact[i]=fact[i-1]*i
    dp=np.zeros((N+1,18001))
    dp[0,0]=1/fact[N]
    for s in S:
        dp[1:,s:]+=dp[:-1,:-s]
    for s in S:
        for i in range(1,N+1):
            dp[i,s:]-=dp[i-1,:-s]
        for i in range(N):
            for j in range(L):
                ans+=fact[i]*dp[i,j]*fact[N-i-1]
        for i in range(N,0,-1):
            dp[i,s:]+=dp[i-1,:-s]
print(ans)
0