結果

問題 No.567 コンプリート
ユーザー snrnsidysnrnsidy
提出日時 2021-11-21 00:22:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 937 bytes
コンパイル時間 2,052 ms
コンパイル使用メモリ 200,912 KB
実行使用メモリ 503,560 KB
最終ジャッジ日時 2023-09-03 12:30:59
合計ジャッジ時間 4,072 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

double dp[1000001][1<<6];
vector <int> p[1<<6];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;

    cin >> n;

    for(int i=0;i<(1<<6);i++)
    {
        int bcnt = 0;
        for(int j=0;j<6;j++)
        {
            if((i&(1<<j)))
            {
                bcnt++;
            }
            else
            {
                p[i].push_back(j);
            }
        }
    }
    dp[0][0] = 1;

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<(1<<6);j++)
        {
            if(dp[i][j]<=0) continue;
            int cnt = p[j].size();
            dp[i+1][j] += (dp[i][j]*(cnt/6));
            for(auto k : p[j])
            {
                int bitmask = (j | (1<<k));
                dp[i+1][bitmask] += (dp[i][j]/6);
            }
        }
    }

    cout << fixed;
    cout.precision(16);

    cout << dp[n][63] << '\n';

    return 0;
}
0