結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー 小野寺健小野寺健
提出日時 2021-11-28 21:20:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 815 bytes
コンパイル時間 5,058 ms
コンパイル使用メモリ 74,816 KB
実行使用メモリ 60,312 KB
最終ジャッジ日時 2023-09-14 09:13:40
合計ジャッジ時間 11,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,952 KB
testcase_01 AC 121 ms
56,112 KB
testcase_02 AC 120 ms
56,152 KB
testcase_03 AC 121 ms
55,748 KB
testcase_04 AC 247 ms
58,704 KB
testcase_05 AC 118 ms
55,528 KB
testcase_06 AC 119 ms
55,776 KB
testcase_07 AC 123 ms
55,516 KB
testcase_08 AC 119 ms
55,664 KB
testcase_09 AC 120 ms
55,644 KB
testcase_10 AC 152 ms
58,172 KB
testcase_11 AC 151 ms
58,392 KB
testcase_12 AC 275 ms
59,308 KB
testcase_13 AC 124 ms
55,652 KB
testcase_14 AC 217 ms
59,824 KB
testcase_15 AC 226 ms
59,244 KB
testcase_16 AC 237 ms
59,148 KB
testcase_17 AC 262 ms
59,260 KB
testcase_18 AC 271 ms
60,012 KB
testcase_19 AC 303 ms
60,312 KB
testcase_20 AC 150 ms
54,380 KB
testcase_21 AC 139 ms
57,732 KB
testcase_22 AC 132 ms
55,796 KB
testcase_23 AC 124 ms
56,324 KB
testcase_24 AC 137 ms
56,008 KB
testcase_25 AC 171 ms
58,756 KB
testcase_26 AC 162 ms
58,588 KB
testcase_27 AC 167 ms
58,516 KB
testcase_28 AC 257 ms
59,676 KB
testcase_29 AC 253 ms
59,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class No1749 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int T = scan.nextInt();
		int MOD = 998244353;
		int[][] v = new int[N][2];
		List<List<Integer>> r = new ArrayList<List<Integer>>();
		for (int i=0; i < N; i++) {
			r.add(new ArrayList<Integer>());
		}
		for (int i=0; i < M; i++) {
			int s = scan.nextInt();
			int t = scan.nextInt();
			r.get(s).add(t);
			r.get(t).add(s);
		}
		v[0][0] = 1;
		for (int t=0; t < T; t++) {
			for (int i=0; i < N; i++) {
				v[i][(t+1) % 2] = 0;
				for (int j : r.get(i)) {
					v[i][(t+1) % 2] = (v[i][(t+1)%2] + v[j][t % 2]) % MOD;
				}
			}
		}
		System.out.println(v[0][T % 2]);
	}

}
0