結果
問題 | No.155 生放送とBGM |
ユーザー | 👑 kmjp |
提出日時 | 2015-02-17 23:57:58 |
言語 | C++11 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,327 bytes |
コンパイル時間 | 1,270 ms |
コンパイル使用メモリ | 146,636 KB |
実行使用メモリ | 108,200 KB |
最終ジャッジ日時 | 2023-09-06 01:29:51 |
合計ジャッジ時間 | 7,498 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | RE | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | WA | - |
testcase_10 | AC | 3 ms
4,376 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 3 ms
4,380 KB |
testcase_14 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<to;x++) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,L; int S[100]; int sum; double fact[100]; double dp[51][7500][51]; void solve() { int i,j,k,l,r,x,y; string s; fact[0]=fact[1]=1; for(i=2;i<=80;i++) fact[i]=fact[i-1]*i; scanf("%d%d",&N,&L); L*=60; FOR(i,N) { scanf("%d:%d",&x,&y); S[i]=x*60+y; sum+=S[i]; } if(L>=sum) return _P("%d\n",N); dp[0][0][0]=1; FOR(i,N) { FOR(x,i+1) { FOR(y,7401) if(dp[i][y][x]) { dp[i+1][min(7401,y+S[i])][x+1] += dp[i][y][x]; dp[i+1][y][x] += dp[i][y][x]; } } } double ret=0; FOR(i,N) { for(y=S[i];y<=L+S[i]-1;y++) { for(x=1;x<=N;x++) if(dp[N][y][x] && dp[N][y-S[i]][x-1]) { ret += dp[N][y][x] * fact[x-1] * fact[N-x]; } } } ret /= fact[N]; _P("%.12lf\n",ret); } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }