結果

問題 No.1937 Various Tournament
ユーザー colognecologne
提出日時 2022-05-13 21:48:16
言語 C++23(draft)
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,048 bytes
コンパイル時間 4,042 ms
使用メモリ 13,996 KB
最終ジャッジ日時 2023-02-21 13:55:11
合計ジャッジ時間 10,941 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
7,592 KB
testcase_01 AC 191 ms
13,924 KB
testcase_02 AC 189 ms
13,996 KB
testcase_03 AC 190 ms
13,948 KB
testcase_04 AC 191 ms
13,996 KB
testcase_05 AC 1 ms
7,596 KB
testcase_06 AC 186 ms
13,868 KB
testcase_07 AC 187 ms
13,936 KB
testcase_08 AC 1 ms
10,284 KB
testcase_09 AC 188 ms
13,980 KB
testcase_10 AC 1 ms
7,584 KB
testcase_11 AC 189 ms
13,924 KB
testcase_12 AC 186 ms
13,868 KB
testcase_13 AC 189 ms
13,972 KB
testcase_14 AC 190 ms
13,868 KB
testcase_15 AC 187 ms
13,864 KB
testcase_16 AC 188 ms
13,864 KB
testcase_17 AC 189 ms
13,928 KB
testcase_18 AC 187 ms
13,932 KB
testcase_19 AC 187 ms
13,932 KB
testcase_20 AC 2 ms
7,656 KB
testcase_21 AC 1 ms
7,724 KB
testcase_22 AC 188 ms
13,976 KB
testcase_23 AC 189 ms
13,944 KB
testcase_24 AC 188 ms
13,864 KB
testcase_25 AC 1 ms
7,580 KB
testcase_26 AC 189 ms
13,988 KB
testcase_27 AC 1 ms
10,264 KB
testcase_28 AC 189 ms
13,924 KB
testcase_29 AC 2 ms
7,660 KB
testcase_30 AC 188 ms
13,864 KB
testcase_31 AC 190 ms
13,932 KB
testcase_32 AC 187 ms
13,976 KB
testcase_33 AC 191 ms
13,932 KB
testcase_34 AC 188 ms
13,932 KB
testcase_35 AC 188 ms
13,932 KB
testcase_36 AC 188 ms
13,996 KB
testcase_37 AC 2 ms
7,600 KB
testcase_38 AC 2 ms
10,284 KB
testcase_39 AC 190 ms
13,968 KB
testcase_40 AC 1 ms
7,672 KB
testcase_41 AC 1 ms
10,248 KB
testcase_42 AC 190 ms
13,980 KB
testcase_43 AC 1 ms
7,684 KB
testcase_44 AC 1 ms
10,332 KB
testcase_45 AC 191 ms
13,992 KB
testcase_46 AC 1 ms
7,588 KB
testcase_47 AC 1 ms
7,660 KB
testcase_48 AC 1 ms
7,608 KB
testcase_49 AC 1 ms
10,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N;
    scanf("%d", &N);
    vector<vector<int>> S(N, vector<int>(N));
    for (auto &y : S)
        for (int &x : y)
            scanf("%d", &x);

    vector<vector<long>> DP(1 << N, vector<long>(N));

    for (int i = 0; i < N; i++)
        DP[1 << i][i] = 1;

    for (int k = 2; k <= N; k *= 2)
        for (int i = 1; i < (1 << N); i++)
            if (popcount((unsigned)i) == k)
            {
                for (int j = 0; (j = (j - i) & i);)
                    if (j > i - j && popcount((unsigned)j) == k / 2)
                    {
                        for (int x = 0; x < N; x++)
                            for (int y = 0; y < N; y++)
                                if (S[x][y])
                                    DP[i][x] += 2 * DP[j][x] * DP[i - j][y];
                                else
                                    DP[i][y] += 2 * DP[j][x] * DP[i - j][y];
                    }
            }
    for (auto y : DP.back())
        cout << y << endl;
}
0