結果

問題 No.1749 ラムドスウイルスの感染拡大
コンテスト
ユーザー V_Melville
提出日時 2021-11-20 22:22:52
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 612 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 17,390 ms
コンパイル使用メモリ 379,720 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-05 06:17:59
合計ジャッジ時間 6,959 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::vector;
using mint = modint998244353;

int main() {
	int n, m, t;
	cin >> n >> m >> t;
	
	vector<vector<int>> to(n);
	rep(i, m) {
		int s, t;
		cin >> s >> t;
		to[s].push_back(t);
		to[t].push_back(s);
	}
	
	vector<mint> dp(n);
	dp[0] = 1;
	rep(i, t) {
		vector<mint> p(n);
		swap(dp, p);
		rep(j, n) {
			for (int k : to[j]) {
				dp[j] += p[k];
			}
		}
	}
	
	cout << dp[0].val() << '\n';
	
	return 0;
}
0