結果

問題 No.1937 Various Tournament
ユーザー 👑 colognecologne
提出日時 2022-05-13 21:48:16
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 1,048 bytes
コンパイル時間 3,155 ms
コンパイル使用メモリ 254,112 KB
実行使用メモリ 14,160 KB
最終ジャッジ日時 2023-09-29 06:55:42
合計ジャッジ時間 10,332 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 191 ms
13,876 KB
testcase_02 AC 188 ms
13,988 KB
testcase_03 AC 186 ms
13,880 KB
testcase_04 AC 190 ms
13,920 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 188 ms
13,916 KB
testcase_07 AC 187 ms
13,840 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 185 ms
13,820 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 189 ms
13,948 KB
testcase_12 AC 187 ms
14,148 KB
testcase_13 AC 188 ms
14,160 KB
testcase_14 AC 188 ms
13,916 KB
testcase_15 AC 186 ms
14,136 KB
testcase_16 AC 188 ms
13,920 KB
testcase_17 AC 193 ms
13,948 KB
testcase_18 AC 187 ms
13,984 KB
testcase_19 AC 186 ms
13,964 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 188 ms
13,928 KB
testcase_23 AC 192 ms
13,932 KB
testcase_24 AC 187 ms
13,812 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 189 ms
14,128 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 190 ms
13,884 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 188 ms
13,880 KB
testcase_31 AC 189 ms
13,880 KB
testcase_32 AC 192 ms
13,812 KB
testcase_33 AC 187 ms
13,976 KB
testcase_34 AC 187 ms
13,912 KB
testcase_35 AC 189 ms
13,952 KB
testcase_36 AC 188 ms
13,836 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 188 ms
13,932 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 188 ms
13,976 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 188 ms
13,860 KB
testcase_46 AC 1 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 2 ms
4,376 KB
testcase_49 AC 1 ms
4,380 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