結果
| 問題 |
No.1749 ラムドスウイルスの感染拡大
|
| コンテスト | |
| ユーザー |
maimaicorgi
|
| 提出日時 | 2022-09-27 13:32:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 2,615 bytes |
| コンパイル時間 | 1,713 ms |
| コンパイル使用メモリ | 139,684 KB |
| 最終ジャッジ日時 | 2025-02-07 17:14:37 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <ios>
#include <iomanip>
#include <queue>
#include <numeric>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <climits>
#include <stack>
#include <regex>
#include <functional>
#include <random>
#ifdef _WIN64
# include <atcoder/all>
#endif
#ifdef _MSC_VER
# include <intrin.h>
# define __builtin_popcount __popcnt
# define __builtin_popcountl __popcnt64
#endif
using namespace std;
#define ll long long
#define rep(i, init, n) for(ll i = init; i < (ll)n; i++)
#define rrep(i, init, n) for(ll i = init; i >= (ll)n; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x.size())
#define Out(x) cout << x << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define Ans cout << ans << endl
#define PI 3.14159265358979
#define MOD 998244353
const int inf32 = INT_MAX / 2;
const ll inf64 = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
// -------------------------------------------------------------------------------------------------
struct mint
{
ll x;
mint(ll val = 0) { x = (val % MOD + MOD) % MOD; }
mint operator-() const { return mint(-x); }
mint& operator+=(const mint& other) { x += other.x; if (x >= MOD) x -= MOD; return *this; }
mint& operator-=(const mint& other) { x -= other.x; if (x < 0) x += MOD; return *this; }
mint& operator*=(const mint& other) { (x *= other.x) %= MOD; return *this; }
mint& operator/=(const mint& other) { *this *= other.pow(MOD - 2); return *this; }
mint operator+(const mint& other) const { return mint(*this) += other; }
mint operator-(const mint& other) const { return mint(*this) -= other; }
mint operator*(const mint& other) const { return mint(*this) *= other; }
mint operator/(const mint& other) const { return mint(*this) /= other; }
mint pow(ll i) const
{
mint ret = 1;
for (mint tmp = x; i; tmp *= tmp, i >>= 1) if (i & 1) ret *= tmp;
return ret;
}
friend ostream& operator<<(ostream& os, const mint& m) { os << m.x; return os; }
};
int main()
{
ll n, m, t; cin >> n >> m >> t;
vector rel(n, vector<int>());
rep(i, 0, m)
{
int a, b; cin >> a >> b;
rel[a].push_back(b);
rel[b].push_back(a);
}
vector dp(t + 1, vector<mint>(n));
dp[0][0] = 1;
rep(i, 1, t + 1)rep(j, 0, n)
{
for (int to : rel[j]) dp[i][to] += dp[i - 1][j];
}
Out(dp[t][0]);
return 0;
}
maimaicorgi