結果
| 問題 | No.2389 Cheating Code Golf |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-21 21:47:12 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 44 ms / 2,000 ms |
| + 948µs | |
| コード長 | 620 bytes |
| 記録 | |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 83,192 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-09-02 00:15:41 |
| 合計ジャッジ時間 | 2,953 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
#include<iostream>
#include<iomanip>
#include<cassert>
using namespace std;
int N,M;
int A[12],B[12],P[12];
double dp[1<<12][41];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>M;
for(int i=0;i<N;i++)cin>>A[i]>>B[i]>>P[i];
for(int i=0;i<1<<N;i++)for(int j=0;j<=M;j++)
{
double ans=0;
for(int k=0;k<N;k++)if(i>>k&1)
{
double prob=1;
double cur=0;
for(int t=0;t<=j;t++)
{
ans=max(ans,cur+(dp[i^1<<k][j-t]+1./A[k])*prob);
cur+=(dp[i^1<<k][j-t]+1./B[k])*prob/P[k];
prob*=1-1./P[k];
}
}
dp[i][j]=ans;
}
cout<<fixed<<setprecision(16)<<dp[(1<<N)-1][M]<<endl;
}