結果
| 問題 |
No.2435 Order All Company
|
| コンテスト | |
| ユーザー |
yuyu_5510
|
| 提出日時 | 2023-08-11 21:17:37 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 851 bytes |
| コンパイル時間 | 5,138 ms |
| コンパイル使用メモリ | 163,236 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 22:48:42 |
| 合計ジャッジ時間 | 7,715 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int main(){
int N, K;
cin >> N >> K;
vector G(K, vector(N, vector(N, 0LL)));
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;
}
}
vector<vector<long long>> dp(N+1, vector<long long>(1<<K, 0));
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;
}
yuyu_5510