結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
using mint = modint998244353;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	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<mint>> dp(N, vector<mint>(T + 1, 0));
	dp[0][0] = 1;
	for (int i = 0; i < T; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < (int)(G[j].size()); k++) {
				dp[G[j][k]][i + 1] += dp[j][i];
			}
		}
	}
	cout << dp[0][T].val() << endl;
	return 0;
}
0