結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー | brthyyjp |
提出日時 | 2021-11-24 09:09:56 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 914 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 10,884 KB |
実行使用メモリ | 13,996 KB |
最終ジャッジ日時 | 2023-09-08 15:15:45 |
合計ジャッジ時間 | 19,121 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
12,608 KB |
testcase_01 | AC | 16 ms
8,196 KB |
testcase_02 | AC | 16 ms
8,272 KB |
testcase_03 | AC | 17 ms
8,256 KB |
testcase_04 | AC | 364 ms
8,552 KB |
testcase_05 | AC | 17 ms
8,348 KB |
testcase_06 | AC | 16 ms
8,244 KB |
testcase_07 | AC | 16 ms
8,200 KB |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | AC | 1,960 ms
9,340 KB |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
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 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
# A*B def mat_mul(A, B, mod): C = [[0]*len(B[0]) for i in range(len(A))] for i in range(len(A)): for k in range(len(B)): for j in range(len(B[0])): C[i][j] = (C[i][j] + A[i][k]*B[k][j])%mod return C #A**n def mat_pow(A, n, mod): B = [[0]*len(A) for i in range(len(A))] for i in range(len(A)): B[i][i] = 1 for i in range(n.bit_length()): if (n >> i)&1: B = mat_mul(A, B, mod) A = mat_mul(A, A, mod) return B 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 = mat_pow(A, t, mod) ans = A[0][0]%mod print(ans) if __name__ == '__main__': main()