結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー forest3forest3
提出日時 2021-12-18 23:16:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,869 ms
コンパイル使用メモリ 173,660 KB
実行使用メモリ 11,012 KB
最終ジャッジ日時 2023-10-13 18:15:25
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 8 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 8 ms
11,012 KB
testcase_11 AC 9 ms
10,920 KB
testcase_12 AC 15 ms
10,656 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 3 ms
4,352 KB
testcase_16 AC 4 ms
4,348 KB
testcase_17 AC 7 ms
5,572 KB
testcase_18 AC 11 ms
9,608 KB
testcase_19 AC 9 ms
8,568 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 2 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 6 ms
8,284 KB
testcase_26 AC 3 ms
4,856 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 8 ms
4,348 KB
testcase_29 AC 8 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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 );
	}

	const long long MOD = 998244353;
	vector<vector<long long>> dp( T + 1, vector<long long>( N ) );
	dp[0][0] = 1;
	for( int i = 1; i < T + 1; i++ ) {
		for( int j = 0; j < N; j++ ) {
			for( int e : g[j] ) {
				dp[i][j] += dp[i - 1][e];
				dp[i][j] %= MOD;
			}
		}
	}
	long long ans = dp[T][0];

	cout << ans << endl;
}
0