結果

問題 No.1749 ラムドスウイルスの感染拡大
コンテスト
ユーザー ks2m
提出日時 2021-11-19 21:51:12
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 136 ms / 2,000 ms
+ 355µs
コード長 689 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,399 ms
コンパイル使用メモリ 85,600 KB
実行使用メモリ 50,256 KB
最終ジャッジ日時 2026-10-10 01:25:43
合計ジャッジ時間 5,396 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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