結果

問題 No.242 ビンゴゲーム
ユーザー t98slidert98slider
提出日時 2022-06-21 08:40:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,324 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 168,732 KB
実行使用メモリ 538,788 KB
最終ジャッジ日時 2023-08-04 04:32:32
合計ジャッジ時間 7,586 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    array<double, 1 << 25> dp{};
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        int rem = 99 - i;
        array<double, 1 << 25> dp2{};
        for(int j = 0; j < (1 << 25); j++){
            if(dp[j] == 0)continue;
            int cnt = 25 - __builtin_popcount(j);
            dp2[j] += dp[j] * (rem - cnt) / rem;
            if(cnt == 0)continue;
            for(int k = 0; k < 25; k++){
                if(j >> k & 1)continue;
                dp2[j | (1 << k)] += dp[j] * cnt / rem;
            }
        }
        swap(dp, dp2);
    }
    vector<int> cand;
    int S = 0b11111;
    for(int i = 0; i < 5; i++){
        cand.push_back(S << 5 * i);
    }
    S = 0b0000100001000010000100001;
    for(int i = 0; i < 5; i++){
        cand.push_back(S << i);
    }
    cand.push_back(0);
    for(int i = 0; i < 5; i++){
        cand.back() |= 1 << i * 5 + i;
    }
    cand.push_back(0);
    for(int i = 0; i < 5; i++){
        cand.back() |= 1 << i * 5 + 5 - i;
    }
    double ans = 0;
    for(int i = 0; i < (1 << 25); i++){
        if(__builtin_popcount(i) < 5)continue;
        int cnt = 0;
        for(auto &&S: cand){
            cnt += ((S & i) == S);
        }
        ans += cnt * dp[i];
    }
    printf("%.15lf\n", ans);
}
0