結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー maguroflymagurofly
提出日時 2021-11-19 21:43:31
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 23,264 KB
最終ジャッジ日時 2023-08-30 07:53:43
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,064 KB
testcase_01 AC 82 ms
15,240 KB
testcase_02 AC 81 ms
15,124 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 81 ms
15,348 KB
testcase_06 AC 83 ms
15,016 KB
testcase_07 AC 84 ms
15,024 KB
testcase_08 AC 82 ms
15,300 KB
testcase_09 AC 82 ms
15,296 KB
testcase_10 AC 190 ms
23,264 KB
testcase_11 AC 186 ms
23,264 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 82 ms
15,088 KB
testcase_23 AC 83 ms
15,156 KB
testcase_24 WA -
testcase_25 AC 161 ms
20,412 KB
testcase_26 AC 109 ms
17,148 KB
testcase_27 AC 98 ms
16,072 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M, T = gets.split.map(&:to_i)
MOD = 998244353
edges = []
M.times do
    s, t = gets.split.map { |s| s.to_i - 1 }
    edges << [s, t]
end

dp = Array.new(N, 0)
dp[0] = 1

T.times do
    dp2 = Array.new(N, 0)
    edges.each do |s, t|
        dp2[s] += dp[t]
        dp2[t] += dp[s]
    end
    N.times do |i|
        dp2[i] %= MOD
    end
    dp = dp2
end

puts dp[0] % MOD
0