結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ku_senjanku_senjan
提出日時 2023-06-04 11:25:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 72,328 KB
実行使用メモリ 7,660 KB
最終ジャッジ日時 2023-08-28 08:11:40
合計ジャッジ時間 2,444 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,360 KB
testcase_01 AC 4 ms
7,360 KB
testcase_02 AC 5 ms
7,632 KB
testcase_03 AC 4 ms
7,416 KB
testcase_04 AC 9 ms
7,660 KB
testcase_05 AC 4 ms
7,416 KB
testcase_06 AC 5 ms
7,368 KB
testcase_07 AC 4 ms
7,636 KB
testcase_08 AC 5 ms
7,424 KB
testcase_09 AC 5 ms
7,428 KB
testcase_10 AC 6 ms
7,480 KB
testcase_11 AC 5 ms
7,564 KB
testcase_12 AC 10 ms
7,400 KB
testcase_13 AC 5 ms
7,560 KB
testcase_14 AC 5 ms
7,380 KB
testcase_15 AC 6 ms
7,436 KB
testcase_16 AC 7 ms
7,456 KB
testcase_17 AC 8 ms
7,452 KB
testcase_18 AC 9 ms
7,528 KB
testcase_19 AC 8 ms
7,436 KB
testcase_20 AC 5 ms
7,360 KB
testcase_21 AC 5 ms
7,560 KB
testcase_22 AC 4 ms
7,368 KB
testcase_23 AC 4 ms
7,444 KB
testcase_24 AC 5 ms
7,356 KB
testcase_25 AC 6 ms
7,428 KB
testcase_26 AC 5 ms
7,368 KB
testcase_27 AC 5 ms
7,416 KB
testcase_28 AC 10 ms
7,376 KB
testcase_29 AC 9 ms
7,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint998244353;

constexpr int MAX_N = 1010;
constexpr int MAX_T = 1010;
int N, M, T;
vector<int> G[MAX_N];
mint dp[MAX_T][MAX_N];

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

  dp[0][0] = 1;
  for(int i=0; i<T; i++){
    for(int j=0; j<N; j++){
      for(int k:G[j]){
        dp[i+1][j]+=dp[i][k];
      }
    }
  }

  cout << dp[T][0].val() << endl;
}
0