結果
問題 | No.1749 ラムドスウイルスの感染拡大 |
ユーザー |
![]() |
提出日時 | 2021-11-19 21:53:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 1,930 ms |
コンパイル使用メモリ | 175,252 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-12-31 23:10:30 |
合計ジャッジ時間 | 3,402 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;const ll MOD = 998244353;using P = pair<int,int>;#define rep(i, n) for(int i = 0; i < n; i++)#define all(x) (x).begin(),(x).end()int main(){int n,m,t;cin >> n >> m >> t;vector<vector<int>> st(m,vector<int>(2));rep(i,m){cin >> st[i][0] >> st[i][1];}vector<vector<ll>> dp(t+1,vector<ll>(n,0));dp[0][0] = 1;rep(i,t){rep(j,m){dp[i+1][st[j][1]] += dp[i][st[j][0]];dp[i+1][st[j][0]] += dp[i][st[j][1]];}rep(j,n) dp[i+1][j] %= MOD;}cout << dp[t][0] << endl;return 0;}