結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー MasKoaTSMasKoaTS
提出日時 2021-11-20 17:40:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,365 bytes
コンパイル時間 4,846 ms
コンパイル使用メモリ 260,324 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 13:15:11
合計ジャッジ時間 6,393 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <math.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define max(p, q) ((p) > (q) ? (p) : (q))
#define min(p, q) ((p) < (q) ? (p) : (q))
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define lb lower_bound;
#define ub upper_bound;
#define lbi(A, x) (ll)(lb(all(A), x) - A.begin())
#define ubi(A, x) (ll)(ub(all(A), x) - A.begin())
using ll = long long;
using P = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T> >;
template <class T>
const ll INF = 1000000000000000001;
const int inf = 1001001001;
const ll mod = 1000000007;
const ll MOD = 998244353;
inline V<int> dtois(string& s) { V<int> vec = {}; for (auto& e : s) { vec.push_back(e - '0'); } return vec; }


int main(void) {
	int n, m, t;	cin >> n >> m >> t;
	VV<int> route(n, V<int>(0));
	rep(i, 0, m) {
		int a, b;	cin >> a >> b;
		route[a].push_back(b);
		route[b].push_back(a);
	}

	V<ll> dp(n);	V<ll> ndp(n);
	dp[0] = 1;
	rep(i, 1, t + 1) {
		rep(j, 0, n) {
			ndp[j] = 0;
			for (auto& k : route[j]) {
				//cout << i << ' ' << j << ' ' << k << endl;
				ndp[j] += dp[k];
				ndp[j] %= MOD;
			}
		}
		rep(j, 0, n) {
			dp[j] = ndp[j];
			//cout << dp[j] << ',';
		}
		//cout << endl;
	}

	cout << dp[0] << endl;
	return 0;
}
0