結果

問題 No.155 生放送とBGM
ユーザー 沙耶花沙耶花
提出日時 2021-11-02 21:04:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 952 bytes
コンパイル時間 4,721 ms
コンパイル使用メモリ 258,244 KB
実行使用メモリ 29,480 KB
最終ジャッジ日時 2024-04-20 07:46:28
合計ジャッジ時間 19,422 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){	
	
	int N,L;
	cin>>N>>L;
	
	L *= 60;
	
	vector<int> t(N);
	long long sum = 0;
	rep(i,N){
		int m,s;
		scanf("%d:%d",&m,&s);
		t[i] = m*60+s;
		sum += t[i];
	}
	
	vector<double> f(N+5,1.0);
	for(int i=1;i<f.size();i++)f[i] = f[i-1] * i;
	
	double ans = 0.0;
	
	rep(i,N){
		vector dp(L,vector<long long>(N,0));
		dp[0][0] = 1LL;
		rep(j,N){
			if(i==j)continue;
			vector ndp(L,vector<long long>(N,0));
			
			rep(k,L){
				rep(l,N){
					if(dp[k][l]==0)continue;
					ndp[k][l] += dp[k][l];
					if(k+t[j]<L)ndp[k+t[j]][l+1] += dp[k][l];
				}
			}
			swap(dp,ndp);
		}

		rep(j,L){
			rep(k,N){
				ans += dp[j][k] * f[k] * f[N-1-k];
			}
		}
		
	}
	
	rep(i,N)ans /= i+1;
	
	cout<<fixed<<setprecision(10)<<ans<<endl;
	
	
	return 0;
	
}
0