結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ああいいああいい
提出日時 2021-12-03 19:29:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 55,680 KB
最終ジャッジ日時 2023-09-20 05:18:44
合計ジャッジ時間 7,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
36,812 KB
testcase_01 AC 137 ms
29,668 KB
testcase_02 AC 137 ms
29,652 KB
testcase_03 AC 137 ms
29,612 KB
testcase_04 WA -
testcase_05 AC 138 ms
29,660 KB
testcase_06 AC 138 ms
29,608 KB
testcase_07 AC 136 ms
29,556 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

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] * 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])

0