結果

問題 No.155 生放送とBGM
ユーザー koprickykopricky
提出日時 2018-12-25 20:12:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 241 ms / 6,000 ms
コード長 2,350 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 168,948 KB
実行使用メモリ 21,600 KB
最終ジャッジ日時 2024-04-08 22:39:24
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 226 ms
21,600 KB
testcase_01 AC 223 ms
21,600 KB
testcase_02 AC 241 ms
21,600 KB
testcase_03 AC 207 ms
21,596 KB
testcase_04 AC 11 ms
13,012 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 209 ms
20,604 KB
testcase_07 AC 3 ms
8,152 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 4 ms
8,196 KB
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 5 ms
8,296 KB
testcase_12 AC 5 ms
8,264 KB
testcase_13 AC 3 ms
8,036 KB
testcase_14 AC 150 ms
20,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 55;
const int MAX_LEN = 21605;

int s[MAX_N];
double dp[MAX_N][MAX_LEN];
double tmp[MAX_N][MAX_LEN];
double fac[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, L;
    cin >> n >> L;
    L *= 60;
    rep(i,n){
        string t;
        cin >> t;
        s[i] = (t[0]-'0')*600+(t[1]-'0')*60+(t[3]-'0')*10+(t[4]-'0');
    }
    dp[0][0] = 1;
    rep(i,n){
        rrep(j,n){
            rep(k,L){
                dp[j+1][k+s[i]] += dp[j][k];
            }
        }
    }
    fac[0] = 1;
    rep(i,n){
        fac[i+1] = fac[i]*(i+1);
    }
    double ans = 0;
    rep(i,n){
        rep(j,n+1){
            rep(k,L){
                tmp[j][k] = dp[j][k];
            }
        }
        rep(j,n){
            rep(k,L-s[i]){
                tmp[j+1][k+s[i]] -= tmp[j][k];
            }
        }
        rep(j,n){
            rep(k,L){
                ans += tmp[j][k]*fac[j]*fac[n-1-j]/fac[n];
            }
        }
    }
    printf("%.12lf\n",ans);
    return 0;
}
0