結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー ああいいああいい
提出日時 2021-12-03 19:23:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 29,756 KB
最終ジャッジ日時 2023-09-20 04:35:01
合計ジャッジ時間 8,029 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
29,648 KB
testcase_01 AC 140 ms
29,564 KB
testcase_02 AC 139 ms
29,600 KB
testcase_03 AC 139 ms
29,628 KB
testcase_04 WA -
testcase_05 AC 140 ms
29,584 KB
testcase_06 AC 140 ms
29,652 KB
testcase_07 AC 141 ms
29,576 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] * 9
power[0] = M
for i in range(1,9):
    power[i] = power[i-1] ** 2 % P
def calc(n):
    ans = None
    flag = False
    for i in range(9):
        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