結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー hourenhouren
提出日時 2021-11-19 21:53:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 1,637 ms
コンパイル使用メモリ 173,648 KB
実行使用メモリ 11,000 KB
最終ジャッジ日時 2023-08-30 08:14:59
合計ジャッジ時間 2,963 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0