結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー erbowl
提出日時 2022-08-18 20:47:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 199,644 KB
最終ジャッジ日時 2025-01-30 23:56:30
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n,m,t;
    std::cin >> n>>m>>t;
    vector<vector<ll>> edges(n);
    for (int i = 0; i < m; i++) {
        ll s,t;
        std::cin >> s>>t;
        // s--;t--;
        edges[s].push_back(t);
        edges[t].push_back(s);
    }
    vector<vector<ll>> dp(t+1,vector<ll>(n+1));
    dp[0][0]=1;
    for (int i = 0; i < t; i++) {
        for (int j = 0; j < n; j++) {
            for (auto e : edges[j]) {
                dp[i+1][j] += dp[i][e];
                dp[i+1][j] %= 998244353;
            }
        }
    }
    std::cout << dp[t][0] << std::endl;
}
0