結果
問題 | No.1749 ラムドスウイルスの感染拡大 |
ユーザー |
![]() |
提出日時 | 2021-11-19 21:51:12 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 258 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 2,253 ms |
コンパイル使用メモリ | 77,024 KB |
実行使用メモリ | 57,460 KB |
最終ジャッジ日時 | 2024-12-31 22:59:41 |
合計ジャッジ時間 | 8,932 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
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]);}}