結果
問題 | No.1749 ラムドスウイルスの感染拡大 |
ユーザー | tenten |
提出日時 | 2021-11-22 10:01:45 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 144 ms / 2,000 ms |
コード長 | 1,736 bytes |
コンパイル時間 | 2,661 ms |
コンパイル使用メモリ | 74,484 KB |
実行使用メモリ | 55,428 KB |
最終ジャッジ日時 | 2023-09-06 00:39:17 |
合計ジャッジ時間 | 6,649 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,420 KB |
testcase_01 | AC | 42 ms
49,692 KB |
testcase_02 | AC | 43 ms
49,664 KB |
testcase_03 | AC | 43 ms
49,416 KB |
testcase_04 | AC | 112 ms
54,784 KB |
testcase_05 | AC | 43 ms
49,372 KB |
testcase_06 | AC | 46 ms
49,560 KB |
testcase_07 | AC | 46 ms
49,576 KB |
testcase_08 | AC | 46 ms
49,844 KB |
testcase_09 | AC | 46 ms
49,536 KB |
testcase_10 | AC | 90 ms
54,676 KB |
testcase_11 | AC | 90 ms
54,636 KB |
testcase_12 | AC | 144 ms
55,428 KB |
testcase_13 | AC | 49 ms
49,632 KB |
testcase_14 | AC | 83 ms
50,852 KB |
testcase_15 | AC | 100 ms
52,844 KB |
testcase_16 | AC | 101 ms
52,460 KB |
testcase_17 | AC | 140 ms
55,304 KB |
testcase_18 | AC | 128 ms
54,960 KB |
testcase_19 | AC | 130 ms
54,804 KB |
testcase_20 | AC | 65 ms
51,840 KB |
testcase_21 | AC | 63 ms
52,092 KB |
testcase_22 | AC | 44 ms
49,820 KB |
testcase_23 | AC | 46 ms
49,604 KB |
testcase_24 | AC | 48 ms
49,512 KB |
testcase_25 | AC | 97 ms
54,784 KB |
testcase_26 | AC | 85 ms
54,736 KB |
testcase_27 | AC | 88 ms
54,704 KB |
testcase_28 | AC | 110 ms
54,992 KB |
testcase_29 | AC | 109 ms
52,584 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { static final int MOD = 998244353; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int t = sc.nextInt(); ArrayList<ArrayList<Integer>> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt(); int b = sc.nextInt(); graph.get(a).add(b); graph.get(b).add(a); } int[] currents = new int[n]; currents[0] = 1; for (int i = 0; i < t; i++) { int[] nexts = new int[n]; for (int j = 0; j < n; j++) { for (int x : graph.get(j)) { nexts[j] += currents[x]; nexts[j] %= MOD; } } currents = nexts; } System.out.println(currents[0]); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }