結果
問題 |
No.1749 ラムドスウイルスの感染拡大
|
ユーザー |
|
提出日時 | 2021-11-28 21:13:29 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 3,355 ms |
コンパイル使用メモリ | 77,052 KB |
実行使用メモリ | 45,092 KB |
最終ジャッジ日時 | 2024-07-01 16:24:37 |
合計ジャッジ時間 | 22,508 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 TLE * 4 |
ソースコード
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]); } }