結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー 小野寺健小野寺健
提出日時 2021-11-28 21:13:29
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 704 bytes
コンパイル時間 3,487 ms
コンパイル使用メモリ 78,956 KB
実行使用メモリ 60,188 KB
最終ジャッジ日時 2023-09-14 09:04:19
合計ジャッジ時間 22,620 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,892 KB
testcase_01 AC 126 ms
56,012 KB
testcase_02 AC 124 ms
55,800 KB
testcase_03 AC 122 ms
56,064 KB
testcase_04 AC 238 ms
59,224 KB
testcase_05 AC 123 ms
56,108 KB
testcase_06 AC 122 ms
55,580 KB
testcase_07 AC 124 ms
56,144 KB
testcase_08 AC 135 ms
56,096 KB
testcase_09 AC 145 ms
56,024 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 126 ms
56,132 KB
testcase_14 AC 204 ms
59,124 KB
testcase_15 AC 226 ms
59,248 KB
testcase_16 AC 226 ms
59,472 KB
testcase_17 AC 477 ms
59,080 KB
testcase_18 TLE -
testcase_19 AC 1,570 ms
59,420 KB
testcase_20 AC 149 ms
56,068 KB
testcase_21 AC 139 ms
55,916 KB
testcase_22 AC 136 ms
56,068 KB
testcase_23 AC 133 ms
55,808 KB
testcase_24 AC 142 ms
56,236 KB
testcase_25 AC 1,673 ms
58,016 KB
testcase_26 AC 672 ms
55,812 KB
testcase_27 AC 426 ms
55,744 KB
testcase_28 AC 224 ms
58,972 KB
testcase_29 AC 230 ms
58,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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];
		boolean[][] r = new boolean[N][N];
		for (int i=0; i < M; i++) {
			int s = scan.nextInt();
			int t = scan.nextInt();
			r[s][t] = true;
			r[t][s] = true;
		}
		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=0; j < N; j++) {
					if (r[i][j]) {
						v[i][(t+1) % 2] = (v[i][(t+1) % 2] + v[j][t % 2]) % MOD;
					}
				}
			}
		}
		System.out.println(v[0][T % 2]);
	}

}
0