結果

問題 No.1750 ラムドスウイルスの感染拡大-hard
ユーザー stngstng
提出日時 2022-05-15 13:58:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 744 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 77,996 KB
最終ジャッジ日時 2023-10-09 22:17:48
合計ジャッジ時間 26,756 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,284 KB
testcase_01 AC 63 ms
71,344 KB
testcase_02 AC 65 ms
75,548 KB
testcase_03 AC 70 ms
76,132 KB
testcase_04 AC 115 ms
76,280 KB
testcase_05 AC 65 ms
71,172 KB
testcase_06 AC 61 ms
71,172 KB
testcase_07 AC 62 ms
70,992 KB
testcase_08 AC 420 ms
76,944 KB
testcase_09 AC 411 ms
77,036 KB
testcase_10 AC 420 ms
77,204 KB
testcase_11 AC 337 ms
76,984 KB
testcase_12 AC 434 ms
76,924 KB
testcase_13 AC 436 ms
77,112 KB
testcase_14 AC 1,939 ms
77,456 KB
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 1,549 ms
77,520 KB
testcase_21 AC 1,619 ms
77,092 KB
testcase_22 AC 344 ms
76,812 KB
testcase_23 AC 1,884 ms
77,392 KB
testcase_24 AC 269 ms
76,724 KB
testcase_25 AC 569 ms
76,932 KB
testcase_26 AC 226 ms
76,876 KB
testcase_27 AC 72 ms
76,332 KB
testcase_28 AC 84 ms
76,296 KB
testcase_29 AC 76 ms
76,024 KB
testcase_30 AC 339 ms
76,688 KB
testcase_31 AC 315 ms
76,736 KB
testcase_32 AC 305 ms
76,868 KB
testcase_33 AC 298 ms
77,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

def dot(A1,A2,n,mod):
  # n:行列のサイズ
  A = [[0]*n for _ in range(n)]
  for i in range(n):
    for j in range(n):
      for k in range(n):
        A[i][j] += A1[i][k]*A2[k][j]
        A[i][j] %= mod
  return A

def pow_mat(A,k,n,mod):
  # A:累乗する行列, k:累乗数, n:行列Aのサイズ
  P = [[0]*n for _ in range(n)]
  for i in range(n): P[i][i] = 1
  while k:
    if k&1: P = dot(P,A,n,mod)
    A = dot(A,A,n,mod)
    k >>= 1
  return P

n,m,T = map(int,input().split())
st = [[] for i in range(n)]
mod = 998244353

st = [[0]*n for i in range(n)]

for i in range(m):
    s,t = map(int,input().split())
    st[s][t] = 1
    st[t][s] = 1

A = pow_mat(st,T,n,mod)
 
print(A[0][0])
0