結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー |
|
提出日時 | 2021-11-19 21:48:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 105,452 KB |
最終ジャッジ日時 | 2024-06-10 08:33:50 |
合計ジャッジ時間 | 7,347 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 33 ms
59,612 KB |
testcase_01 | AC | 34 ms
52,820 KB |
testcase_02 | AC | 36 ms
58,924 KB |
testcase_03 | AC | 36 ms
59,936 KB |
testcase_04 | AC | 137 ms
76,648 KB |
testcase_05 | AC | 32 ms
52,740 KB |
testcase_06 | AC | 33 ms
53,072 KB |
testcase_07 | AC | 32 ms
52,124 KB |
testcase_08 | AC | 473 ms
78,832 KB |
testcase_09 | AC | 448 ms
78,480 KB |
testcase_10 | AC | 486 ms
78,892 KB |
testcase_11 | AC | 484 ms
78,928 KB |
testcase_12 | AC | 562 ms
79,936 KB |
testcase_13 | AC | 632 ms
79,796 KB |
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 | -- | - |
ソースコード
import sys input = sys.stdin.buffer.readline N, M, T = map(int, input().split()) MOD = 998244353 """行列累乗を https://qiita.com/ophhdn/items/e6451ec5983939ecbc5b から拝借しています""" def mat_mul(a, b): I, J, K = len(a), len(b[0]), len(b) c = [[0] * J for _ in range(I)] for i in range(I): for j in range(J): for k in range(K): c[i][j] += a[i][k] * b[k][j] c[i][j] %= MOD return c def mat_pow(x, n): y = [[0] * len(x) for _ in range(len(x))] for i in range(len(x)): y[i][i] = 1 while n > 0: if n & 1: y = mat_mul(x, y) x = mat_mul(x, x) n >>= 1 return y matr = [[0] * N for _ in range(N)] for _ in range(M): s, t = map(int, input().split()) matr[s][t] = 1 matr[t][s] = 1 print(mat_pow(matr, T)[0][0])