結果
問題 | No.155 生放送とBGM |
ユーザー |
![]() |
提出日時 | 2021-09-24 21:26:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 789 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 268,800 KB |
最終ジャッジ日時 | 2024-07-05 10:01:29 |
合計ジャッジ時間 | 21,610 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 TLE * 1 |
ソースコード
import sysreadline=sys.stdin.readlineN,L=map(int,readline().split())L*=60S=[]for s in readline().split():mm,ss=map(int,s.split(":"))S.append(mm*60+ss)ans=0S_sum=sum(S)if L>=S_sum:ans=Nelse:fact=[1]for i in range(1,51):fact.append(fact[-1]*i)dp=[[0]*18001 for i in range(N+1)]dp[0][0]=1/fact[N]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+=fact[i]*dp_[i][j]*fact[N-i-1]print(ans)