結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ああいい
提出日時 2021-12-03 19:14:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 531 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 75,564 KB
最終ジャッジ日時 2024-07-06 00:07:13
合計ジャッジ時間 10,092 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 2
other AC * 1 RE * 3 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N,M,T = list(map(int,input().split()))
d = [[0] * N for _ in range(N)]
P = 998244353

for _ in range(M):
    s,t = list(map(int,input().split()))
    d[s][t] = 1
    d[t][s] = 1
M = np.matrix(d)
power = [0] * 9
power[0] = M
for i in range(1,9):
    power[i] = power[i-1] ** 2 % P
def calc(n):
    ans = None
    for i in range(9):
        if n & (1 << i):
            if ans == None:
                ans = power[i]
            else:
                ans = ans * power[i] % P
    return ans

print(calc(T)[0,0])

0