結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー 小野寺健小野寺健
提出日時 2021-12-17 08:58:13
言語 Go
(1.22.1)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 10,281 ms
コンパイル使用メモリ 211,176 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 10:10:17
合計ジャッジ時間 12,293 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main
import "fmt"

func main() {
	var N int
	var M int
	var T int
	fmt.Scan(&N, &M, &T)
	const MOD int = 998244353
	v := make([][2]int, N, N)
	r := make([][]int, N, N)
	for i := 0; i < M; i++ {
		var s int
		var t int
		fmt.Scan(&s, &t)
		r[s] = append(r[s], t)
		r[t] = append(r[t], s)
	}
	v[0][0] = 1
	for t := 0; t < T; t++ {
		for i := 0; i < N; i++ {
			v[i][(t+1) % 2] = 0
			for _, j := range r[i] {
				v[i][(t+1) % 2] = (v[i][(t+1)%2] + v[j][t % 2]) % MOD
			}
		}
	}
	fmt.Println(v[0][T%2])
}
0