結果
| 問題 | No.1749 ラムドスウイルスの感染拡大 |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2021-11-19 21:51:12 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| コード長 | 689 bytes |
| 記録 | |
| コンパイル時間 | 1,598 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 50,540 KB |
| 最終ジャッジ日時 | 2026-06-05 10:51:00 |
| 合計ジャッジ時間 | 5,864 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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]);
}
}
ks2m