結果
| 問題 | 
                            No.1749 ラムドスウイルスの感染拡大
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-03 19:37:39 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 632 bytes | 
| コンパイル時間 | 309 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 65,124 KB | 
| 最終ジャッジ日時 | 2024-07-06 01:56:25 | 
| 合計ジャッジ時間 | 9,709 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 3 WA * 1 TLE * 1 -- * 21 | 
ソースコード
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,dtype = np.int64)
power = [0] * 10
power[0] = M
for i in range(1,10):
    power[i] = power[i-1] ** 2 % P
def calc(n):
    ans = None
    flag = False
    for i in range(10):
        if n & (1 << i):
            if flag == False:
                ans = power[i]
                flag = True
            else:
                ans = ans * power[i] % P
    return ans
if T == 0:
    print(1)
else:
    print(calc(T)[0,0])