結果

問題 No.1749 ラムドスウイルスの感染拡大
コンテスト
ユーザー ああいい
提出日時 2021-12-03 19:14:39
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 531 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 412 ms
コンパイル使用メモリ 20,672 KB
実行使用メモリ 96,012 KB
最終ジャッジ日時 2026-03-27 10:24:37
合計ジャッジ時間 14,454 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 2
other AC * 1 RE * 3 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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