結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ks2mks2m
提出日時 2021-11-19 21:51:12
言語 Java19
(openjdk 21)
結果
AC  
実行時間 242 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 78,968 KB
実行使用メモリ 59,448 KB
最終ジャッジ日時 2023-08-30 08:09:02
合計ジャッジ時間 7,967 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,776 KB
testcase_01 AC 121 ms
53,412 KB
testcase_02 AC 119 ms
55,816 KB
testcase_03 AC 120 ms
55,784 KB
testcase_04 AC 206 ms
58,808 KB
testcase_05 AC 119 ms
56,080 KB
testcase_06 AC 121 ms
56,004 KB
testcase_07 AC 120 ms
55,956 KB
testcase_08 AC 119 ms
55,448 KB
testcase_09 AC 119 ms
55,516 KB
testcase_10 AC 150 ms
58,284 KB
testcase_11 AC 149 ms
58,528 KB
testcase_12 AC 242 ms
59,056 KB
testcase_13 AC 123 ms
55,816 KB
testcase_14 AC 194 ms
58,412 KB
testcase_15 AC 194 ms
58,732 KB
testcase_16 AC 201 ms
59,388 KB
testcase_17 AC 216 ms
59,276 KB
testcase_18 AC 242 ms
59,284 KB
testcase_19 AC 240 ms
59,448 KB
testcase_20 AC 140 ms
55,960 KB
testcase_21 AC 130 ms
55,840 KB
testcase_22 AC 135 ms
55,868 KB
testcase_23 AC 122 ms
55,748 KB
testcase_24 AC 137 ms
55,616 KB
testcase_25 AC 160 ms
58,112 KB
testcase_26 AC 145 ms
57,572 KB
testcase_27 AC 149 ms
55,956 KB
testcase_28 AC 204 ms
59,196 KB
testcase_29 AC 208 ms
58,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int t = sc.nextInt();
		int[] a = new int[m];
		int[] b = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		sc.close();

		int mod = 998244353;
		long[] ans = new long[n];
		ans[0] = 1;
		for (int i = 0; i < t; i++) {
			long[] wk = new long[n];
			for (int j = 0; j < m; j++) {
				wk[a[j]] += ans[b[j]];
				wk[b[j]] += ans[a[j]];
			}
			for (int j = 0; j < n; j++) {
				wk[j] %= mod;
			}
			ans = wk;
		}
		System.out.println(ans[0]);
	}
}
0