結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー atjh16atjh16
提出日時 2021-12-27 09:45:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 203,708 KB
実行使用メモリ 11,308 KB
最終ジャッジ日時 2023-10-25 08:15:25
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 10 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 29 ms
11,308 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 6 ms
4,348 KB
testcase_17 AC 12 ms
6,512 KB
testcase_18 AC 23 ms
10,712 KB
testcase_19 AC 19 ms
9,936 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 5 ms
4,800 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 9 ms
4,348 KB
testcase_29 AC 9 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int n, m, t, u, v;
const long long M = 998244353;
long long dp[1000][1001];
vector<int> e[1000];

int main(){
    cin >> n >> m >> t;
    
    for(int i = 0; i < m; i++){
        cin >> u >> v;
        
        e[u].push_back(v);
        e[v].push_back(u);
    }
    
    dp[0][0] = 1;
    
    for(int i = 1; i <= t; i++){
        for(int j = 0; j < n; j++){
            for(int k : e[j])
                dp[j][i] = (dp[j][i] + dp[k][i - 1]) % M;
        }
    }
    
    cout << dp[0][t] << endl;
}
0