結果
問題 |
No.1750 ラムドスウイルスの感染拡大-hard
|
ユーザー |
![]() |
提出日時 | 2021-11-24 09:04:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 682 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,736 KB |
最終ジャッジ日時 | 2024-06-26 08:12:53 |
合計ジャッジ時間 | 20,933 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 30 |
ソースコード
import numpy as np #A**n def mat_pow(A, n, mod): size = len(A) res = np.eye(size, dtype=np.object) while n > 0: if n & 1 == 1: res = res @ A res %= mod A = A @ A A %= mod n = n>>1 return res import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline mod = 998244353 def main(): n, m, t = map(int, input().split()) A = [[0]*n for i in range(n)] for i in range(m): u, v = map(int, input().split()) A[u][v] = 1 A[v][u] = 1 A = np.array(A) A = mat_pow(A, t, mod) ans = A[0][0]%mod print(ans) if __name__ == '__main__': main()