結果

問題 No.1750 ラムドスウイルスの感染拡大-hard
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-19 22:45:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,202 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 78,440 KB
最終ジャッジ日時 2023-08-30 09:37:30
合計ジャッジ時間 16,416 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,288 KB
testcase_01 AC 79 ms
71,128 KB
testcase_02 AC 83 ms
75,756 KB
testcase_03 AC 82 ms
76,328 KB
testcase_04 AC 133 ms
77,284 KB
testcase_05 AC 76 ms
71,288 KB
testcase_06 AC 77 ms
71,148 KB
testcase_07 AC 77 ms
71,316 KB
testcase_08 AC 283 ms
77,216 KB
testcase_09 AC 285 ms
77,224 KB
testcase_10 AC 286 ms
77,044 KB
testcase_11 AC 251 ms
77,364 KB
testcase_12 AC 307 ms
77,428 KB
testcase_13 AC 292 ms
77,428 KB
testcase_14 AC 1,120 ms
78,440 KB
testcase_15 AC 1,162 ms
78,088 KB
testcase_16 AC 1,168 ms
78,148 KB
testcase_17 AC 1,170 ms
77,776 KB
testcase_18 AC 1,202 ms
77,744 KB
testcase_19 AC 1,152 ms
77,820 KB
testcase_20 AC 793 ms
77,636 KB
testcase_21 AC 900 ms
77,428 KB
testcase_22 AC 246 ms
77,480 KB
testcase_23 AC 1,074 ms
77,780 KB
testcase_24 AC 205 ms
77,044 KB
testcase_25 AC 361 ms
76,832 KB
testcase_26 AC 182 ms
77,012 KB
testcase_27 AC 94 ms
76,168 KB
testcase_28 AC 97 ms
76,528 KB
testcase_29 AC 90 ms
75,936 KB
testcase_30 AC 244 ms
77,364 KB
testcase_31 AC 233 ms
77,288 KB
testcase_32 AC 235 ms
77,384 KB
testcase_33 AC 225 ms
77,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,t = map(int,input().split())
mod = 998244353

path = [[0]*n for i in range(n)]
edge = [[int(x) for x in input().split()] for i in range(m)]
for u,v in edge:
    path[u][v] = path[v][u] = 1



def calc(a,b):
    ans = [[0]*n for i in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                ans[i][j] += a[i][k]*b[k][j]
                ans[i][j] %= mod
    return ans


base = [[0]*n for i in range(n)]
for i in range(n):
    base[i][i] = 1


while t:
    if t%2:
        base = calc(base,path)
    path = calc(path,path)
    t //= 2

print(base[0][0])
0