結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー Knots_coderKnots_coder
提出日時 2022-03-27 17:59:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 1,367 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 101,336 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-24 04:36:12
合計ジャッジ時間 2,362 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 13 ms
7,296 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 6 ms
7,552 KB
testcase_07 AC 7 ms
7,424 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 8 ms
7,680 KB
testcase_11 AC 8 ms
7,552 KB
testcase_12 AC 18 ms
11,392 KB
testcase_13 AC 6 ms
7,680 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 7 ms
5,376 KB
testcase_17 AC 12 ms
8,960 KB
testcase_18 AC 16 ms
10,368 KB
testcase_19 AC 14 ms
9,856 KB
testcase_20 AC 4 ms
5,504 KB
testcase_21 AC 6 ms
6,656 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 9 ms
9,088 KB
testcase_26 AC 5 ms
5,632 KB
testcase_27 AC 4 ms
5,376 KB
testcase_28 AC 13 ms
7,296 KB
testcase_29 AC 13 ms
6,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <bitset>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <functional>
#include <stack>
#include <cmath>
#include <string>
#include <complex>
#include <cassert>
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = (1<<30)-1;
const int MOD = 1e9+7;
const ll LINF = (1ll<<62)-1;

#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";

ll dp[1010][1010];

int main(){
    int n,m,T,s,t;cin >> n >> m >> T;
    vector<vector<int>> road(n);//road[i][j]の時、道が存在
    REP(i,m){
        cin >> s >> t;
        road[s].push_back(t);
        road[t].push_back(s);
    }
    //dpをやるよ
    //dp[i+1][j] iまでに都市jで感染した人数
    dp[0][0] = 1;
    for(int i=0;i<T;i++){
        for(int j=0;j<n;j++){
            for(int k:road[j]){
                dp[i+1][j] += dp[i][k];
                dp[i+1][j] %= 998244353;
            } 
        }
    }
    COUT(dp[T][0]);
}
0