結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー HIcoder
提出日時 2023-07-15 19:52:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 113,188 KB
最終ジャッジ日時 2025-02-15 15:07:51
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set> 
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
#include <unordered_set>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;
const ll MOD=998244353;

int main(){
    int N,M,T;
    cin>>N>>M>>T;
    
    vector<vector<int>> G(N);
    for(int i=0;i<M;i++){
        int s,t;
        cin>>s>>t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    vector<vector<ll>> num(T+1,vector<ll>(N,0));

    num[0][0]=1;
    for(int t=1;t<=T;t++){
        
        for(int u=0;u<N;u++){
            for(int v:G[u]){
                num[t][v]+=num[t-1][u];
                num[t][v]%=MOD;
            }
        }

    }

    cout<<num[T][0]<<endl;
}
0