結果
| 問題 |
No.1749 ラムドスウイルスの感染拡大
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-30 01:05:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 797 bytes |
| コンパイル時間 | 2,712 ms |
| コンパイル使用メモリ | 200,252 KB |
| 最終ジャッジ日時 | 2025-02-25 01:35:27 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i)
#define all(a) (a).begin(), (a).end()
const ll mod = 998244353ll;
int main() {
cin.tie(nullptr);
int N, M, T;
cin >> N >> M >> T;
vector G(N, vector<int>());
rep(i, 0, M) {
int s, t;
cin >> s >> t;
G[s].push_back(t);
G[t].push_back(s);
}
vector<ll> now(N, 0), pre(N, 0);
pre[0] = 1;
rep(day, 0, T) {
rep(i, 0, N) now[i] = 0;
rep(v, 0, N) {
for (int next : G[v]) {
now[v] += pre[next];
now[v] %= mod;
}
}
rep(i, 0, N) pre[i] = now[i];
}
cout << now[0] << '\n';
}