結果

問題 No.1750 ラムドスウイルスの感染拡大-hard
ユーザー Eki1009Eki1009
提出日時 2021-11-19 21:49:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,232 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 81,872 KB
最終ジャッジ日時 2023-08-30 08:06:57
合計ジャッジ時間 16,854 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,372 KB
testcase_01 AC 76 ms
71,392 KB
testcase_02 AC 77 ms
71,408 KB
testcase_03 AC 83 ms
76,396 KB
testcase_04 AC 116 ms
76,420 KB
testcase_05 AC 76 ms
71,356 KB
testcase_06 AC 77 ms
71,244 KB
testcase_07 AC 74 ms
71,400 KB
testcase_08 AC 262 ms
76,816 KB
testcase_09 AC 261 ms
77,016 KB
testcase_10 AC 257 ms
77,096 KB
testcase_11 AC 218 ms
77,016 KB
testcase_12 AC 282 ms
77,260 KB
testcase_13 AC 269 ms
77,628 KB
testcase_14 AC 1,154 ms
80,764 KB
testcase_15 AC 1,181 ms
80,368 KB
testcase_16 AC 1,200 ms
81,872 KB
testcase_17 AC 1,200 ms
80,028 KB
testcase_18 AC 1,232 ms
80,072 KB
testcase_19 AC 1,190 ms
79,768 KB
testcase_20 AC 799 ms
80,356 KB
testcase_21 AC 924 ms
80,228 KB
testcase_22 AC 235 ms
77,032 KB
testcase_23 AC 1,083 ms
80,096 KB
testcase_24 AC 196 ms
77,124 KB
testcase_25 AC 356 ms
77,104 KB
testcase_26 AC 173 ms
76,892 KB
testcase_27 AC 86 ms
76,328 KB
testcase_28 AC 94 ms
76,492 KB
testcase_29 AC 87 ms
76,296 KB
testcase_30 AC 237 ms
77,016 KB
testcase_31 AC 226 ms
77,080 KB
testcase_32 AC 225 ms
77,008 KB
testcase_33 AC 222 ms
77,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
n,m,t = map(int,input().split())
G = [[0]*n for _ in range(n)]
for _ in range(m):
    u,v = map(int,input().split())
    G[u][v] = G[v][u] = 1
def f(A,B):
    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]*B[k][j]%mod
                C[i][j] %= mod
    return C
def g(n):
    if n == 1:
        return G
    if n%2:
        return f(G,g(n-1))
    T = g(n//2)
    return f(T,T)
ans = g(t)[0][0]
print(ans)
0