結果
| 問題 | No.155 生放送とBGM |
| コンテスト | |
| ユーザー |
T1610
|
| 提出日時 | 2026-10-12 01:05:15 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 667 ms / 6,000 ms |
| + 369µs | |
| コード長 | 1,976 bytes |
| 記録 | |
| コンパイル時間 | 4,180 ms |
| コンパイル使用メモリ | 379,284 KB |
| 実行使用メモリ | 25,216 KB |
| 最終ジャッジ日時 | 2026-10-12 01:05:25 |
| 合計ジャッジ時間 | 9,234 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i, n) REP(i, 0, n)
#define REP(i, s, e) for (ll i = (s); i < (ll)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for (ll i = (ll)(s - 1); i >= (ll)(e); i--)
#define all(r) r.begin(), r.end()
#define rall(r) r.rbegin(), r.rend()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template <typename T, typename U>
bool chmax(T& a, const U& b) {
if (a >= b) return false;
a = b;
return true;
}
template <typename T, typename U>
bool chmin(T& a, const U& b) {
if (a <= b) return false;
a = b;
return true;
}
void yes_no(bool f, string yes = "Yes", string no = "No") {
cout << (f ? yes : no) << "\n";
}
void solve() {
int n, m;
cin >> n >> m;
m *= 60;
vector<int> a(n);
rep(i, n) {
int x, y;
char c;
cin >> x >> c >> y;
a[i] = x * 60 + y;
}
ll sum = accumulate(all(a), 0);
if (sum <= m) {
cout << n << '\n';
return;
}
using D = long double;
vector<D> f(n + 10);
f[0] = f[1] = 1;
REP(i, 2, n + 10)
f[i] = f[i - 1] * i;
const int ma = 2.5e4;
vector<vector<ll>> dp(ma + 1, vector<ll>(n + 1));
dp[0][0] = 1;
rep(i, n) repr(x, i + 1) rep(y, ma) {
dp[min(ma, (int)y + a[i])][x + 1] += dp[y][x];
}
vector ep(ma + 1, vector(n + 1, 0LL));
D ans = 0;
rep(i, n) {
rep(x, n + 1) {
rep(y, m + a[i]) {
ep[y][x] = dp[y][x];
if (y >= a[i] && x > 0) ep[y][x] -= ep[y - a[i]][x - 1];
if (x < n && y < m) ans += ep[y][x] * f[x] * f[n - x - 1];
}
}
}
ans /= f[n];
cout << fixed << setprecision(15);
cout << ans << "\n";
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int t = 1;
// multi-testcase
// cin >> t;
rep(ti, t) solve();
return 0;
}
T1610