結果

問題 No.155 生放送とBGM
ユーザー sugim48sugim48
提出日時 2015-02-18 01:27:43
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,597 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 20,816 KB
最終ジャッジ日時 2023-09-06 01:55:05
合計ジャッジ時間 8,059 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 943 ms
20,732 KB
testcase_01 AC 944 ms
20,732 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 61 ms
5,812 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 943 ms
20,716 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 8 ms
4,956 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 11 ms
4,992 KB
testcase_12 AC 13 ms
5,116 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 729 ms
17,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 4;

int main() {
	int N, L;
	cin >> N >> L;
	L *= 60;
	int l = L + 3600;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		int MM, SS;
		scanf("%d:%d", &MM, &SS);
		a[i] = MM * 60 + SS;
	}
	vector<vector<double> > dp(N + 1, vector<double>(l));
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		vector<vector<double> > _dp(N + 1, vector<double>(l));
		for (int j = 0; j <= i; j++)
			for (int k = 0; k < l; k++) {
				_dp[j][k] += dp[j][k] * (i - j + 1) / (i + 2);
				if (k + a[i] < l)
					_dp[j + 1][k + a[i]] += dp[j][k] * (j + 1) / (i + 2);
			}
		dp = _dp;
	}
	double sum = 0;
	for (int i = 0; i < N; i++) {
		vector<vector<double> > x(N + 1, vector<double>(l));
		for (int j = 0; j <= N - 1; j++)
			for (int k = 0; k < L; k++) {
				if (j == 0 || k < a[i]) x[j][k] = dp[j][k] / (N - j) * (N + 1);
				else x[j][k] = (dp[j][k] - x[j - 1][k - a[i]] * j / (N + 1)) / (N - j) * (N + 1);
				sum += x[j][k];
			}
	}
	printf("%.10f\n", sum);
}
0