結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー Kome_soudou
提出日時 2021-11-27 17:22:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 1,780 ms
コンパイル使用メモリ 174,168 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-30 08:18:39
合計ジャッジ時間 2,766 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
  int64_t N, M, T;
  cin >> N >> M >> T;
  int64_t mod = 998244353;
  
  int64_t s, t;
  vector<vector<int64_t>> G(N);
  for(int64_t i = 0; i < M; i++)
  {
    cin >> s >> t;
    G.at(s).push_back(t);
    G.at(t).push_back(s);
  }
  
  vector<vector<int64_t>> dp(T + 1, vector<int64_t>(N));
  dp.at(0).at(0) = 1;
  for(int64_t i = 0; i < T; i++)
  {
    for(int64_t j = 0; j < N; j++)
    {
      for(int64_t g : G.at(j))
      {
        dp.at(i + 1).at(j) += dp.at(i).at(g);
        dp.at(i + 1).at(j) %= mod;
      }
    }
  }
  
  cout << dp.at(T).at(0) << endl;
  return 0;
}
0