結果

問題 No.155 生放送とBGM
ユーザー mamekinmamekin
提出日時 2015-02-18 22:18:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,021 ms / 6,000 ms
コード長 1,351 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 94,712 KB
実行使用メモリ 10,516 KB
最終ジャッジ日時 2023-09-06 02:08:07
合計ジャッジ時間 14,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,931 ms
10,516 KB
testcase_01 AC 1,943 ms
10,448 KB
testcase_02 AC 2,013 ms
10,368 KB
testcase_03 AC 2,021 ms
10,472 KB
testcase_04 AC 35 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1,736 ms
10,468 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1,316 ms
8,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n, len;
    cin >> n >> len;
    len *= 60;

    vector<int> s(n);
    for(int i=0; i<n; ++i){
        int a, b;
        char c;
        cin >> a >> c >> b;
        s[i] = a * 60 + b;
    }

    double ret = 0.0;
    for(int i=0; i<n; ++i){
        vector<vector<double> > dp(n, vector<double>(len, 0.0));
        dp[0][0] = 1.0;
        for(int j=0; j<n; ++j){
            if(i == j)
                continue;
            for(int a=n-2; a>=0; --a){
                for(int b=0; b+s[j]<len; ++b){
                    dp[a+1][b+s[j]] += dp[a][b];
                }
            }
        }

        double x = 1.0;
        for(int i=1; i<n; ++i)
            x *= i;

        for(int a=0; a<n; ++a){
            for(int b=0; b<len; ++b){
                ret += dp[a][b] * x;
            }
            x *= a + 1;
            x /= n - 1 - a;
        }
    }

    for(int i=1; i<=n; ++i)
        ret /= i;
    printf("%.10f\n", ret);

    return 0;
}
0