結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー umezo
提出日時 2021-11-20 01:43:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 3,225 ms
コンパイル使用メモリ 194,252 KB
最終ジャッジ日時 2025-01-25 21:22:21
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

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

const int MOD=998244353;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m,t;
  cin>>n>>m>>t;
  vector<int> S(m),T(m);
  rep(i,m) cin>>S[i]>>T[i];
  
  vector<int> A(n);
  A[0]=1;
  
  rep(i,t){
    vector<int> B(n);
    rep(j,m){
      B[S[j]]=(B[S[j]]+A[T[j]])%MOD;
      B[T[j]]=(B[T[j]]+A[S[j]])%MOD;
    }
    swap(A,B);
  }
  cout<<A[0]<<endl;
  
  return 0;
}
0