結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー TokuzooTokuzoo
提出日時 2021-12-25 13:04:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 947 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 171,580 KB
実行使用メモリ 7,612 KB
最終ジャッジ日時 2023-10-21 13:56:42
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 9 ms
6,896 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 6 ms
7,496 KB
testcase_07 AC 6 ms
7,500 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 7 ms
7,520 KB
testcase_11 AC 7 ms
7,524 KB
testcase_12 AC 11 ms
7,612 KB
testcase_13 AC 6 ms
7,552 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 4 ms
4,400 KB
testcase_16 AC 5 ms
4,988 KB
testcase_17 AC 9 ms
6,708 KB
testcase_18 AC 11 ms
7,100 KB
testcase_19 AC 5 ms
5,736 KB
testcase_20 AC 4 ms
5,132 KB
testcase_21 AC 5 ms
6,444 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 9 ms
6,896 KB
testcase_29 AC 9 ms
6,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using edge = pair<int,int>;
using djikstra = priority_queue<edge, vector<edge>, greater<edge>>;
const int INF = 1e+9;
const ll LINF = (ll)pow(10,18);
const int mod = INF + 7;
const int lmod = 998244353;

int gcd(int a, int b){
    if(a%b == 0){
        return b;
    } else {
        return gcd(b, a%b);
    }
}

int dp[1002][1002] = {0};

int main(){
    int n,m,t;
    cin >> n >> m >> t;

    Graph g(n);

    int a,b;

    for(int i=0; i<m; i++){
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    dp[0][0] = 1;

    for(int i=0; i<t; i++){
        for(int j=0; j<n; j++){
            if(dp[i][j] > 0){
                for(auto v : g[j]){
                    dp[i+1][v] += dp[i][j];
                    dp[i+1][v] %= lmod;
                }
            }
        }
    }

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