結果

問題 No.2435 Order All Company
ユーザー yuyu_5510yuyu_5510
提出日時 2023-08-11 21:21:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 2,983 ms
コンパイル使用メモリ 215,296 KB
実行使用メモリ 16,188 KB
最終ジャッジ日時 2023-08-15 15:10:43
合計ジャッジ時間 4,818 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,420 KB
testcase_01 AC 2 ms
5,488 KB
testcase_02 AC 3 ms
7,448 KB
testcase_03 WA -
testcase_04 AC 3 ms
11,796 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
9,748 KB
testcase_13 AC 3 ms
11,892 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
const long long mod = 998244353;
long long G[10][1000][1000];
long long dp[1001][1024];

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N, K;
    cin >> N >> K;
    for(int i = 0;i < K;i++){
        int t;
        cin >> t;
        for(int j = 0;j < t;j++){
            int a, b;
            cin >> a >> b;
            --a;--b;
            G[i][a][b] += 1;
            G[i][b][a] += 1;
        }
    }

    dp[1][0] = 1;
    for(int i = 1;i < N;i++){
        for(int j = 0;j < 1<<K;j++){
            for(int k = 0;k < K;k++){
                for(int l = 0;l < i;l++){
                    dp[i+1][j | 1<<k] += (G[k][l][i] * dp[i][j]) % mod;
                    dp[i+1][j | 1<<k] %= mod;
                }
            }
        }
    }

    cout << dp[N][(1<<K)-1] << endl;

}
0