結果

問題 No.1750 ラムドスウイルスの感染拡大-hard
ユーザー 👑 rin204rin204
提出日時 2022-01-23 07:24:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 643 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 100,864 KB
最終ジャッジ日時 2024-05-06 17:36:33
合計ジャッジ時間 25,191 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,376 KB
testcase_01 AC 40 ms
53,504 KB
testcase_02 AC 41 ms
54,400 KB
testcase_03 AC 49 ms
61,568 KB
testcase_04 AC 149 ms
77,740 KB
testcase_05 AC 41 ms
53,632 KB
testcase_06 AC 42 ms
53,632 KB
testcase_07 AC 42 ms
53,632 KB
testcase_08 AC 323 ms
78,984 KB
testcase_09 AC 312 ms
78,728 KB
testcase_10 AC 331 ms
78,984 KB
testcase_11 AC 307 ms
79,616 KB
testcase_12 AC 454 ms
80,256 KB
testcase_13 AC 415 ms
80,256 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 AC 1,913 ms
98,304 KB
testcase_18 AC 1,803 ms
96,128 KB
testcase_19 AC 1,917 ms
97,196 KB
testcase_20 AC 1,495 ms
94,456 KB
testcase_21 AC 1,941 ms
97,408 KB
testcase_22 AC 381 ms
78,840 KB
testcase_23 AC 1,964 ms
98,304 KB
testcase_24 AC 264 ms
78,168 KB
testcase_25 AC 588 ms
81,352 KB
testcase_26 AC 250 ms
77,660 KB
testcase_27 AC 72 ms
71,808 KB
testcase_28 AC 78 ms
74,880 KB
testcase_29 AC 73 ms
72,320 KB
testcase_30 AC 390 ms
78,592 KB
testcase_31 AC 381 ms
78,592 KB
testcase_32 AC 340 ms
78,872 KB
testcase_33 AC 337 ms
78,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy

MOD = 998244353

n, m, T = map(int, input().split())
A = [[0] * n for _ in range(n)]
B = [0] * n
B[0] = 1
for _ in range(m):
    s, t = map(int, input().split())
    A[s][t] = 1
    A[t][s] = 1
    
while T:
    if T & 1:
        C = [0] * n
        for i in range(n):
            for j in range(n):
                C[i] += A[i][j] * B[j]
            C[i] %= MOD
        B = C.copy()
    T >>= 1
    C = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                C[i][j] += A[i][k] * A[k][j]
            C[i][j] %= MOD
    A = deepcopy(C)
print(B[0])
0