結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー | H3PO4 |
提出日時 | 2021-11-19 21:48:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 86,924 KB |
実行使用メモリ | 81,020 KB |
最終ジャッジ日時 | 2023-08-30 08:05:06 |
合計ジャッジ時間 | 9,394 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 78 ms
71,428 KB |
testcase_01 | AC | 74 ms
71,452 KB |
testcase_02 | AC | 77 ms
75,484 KB |
testcase_03 | AC | 78 ms
76,448 KB |
testcase_04 | AC | 185 ms
77,664 KB |
testcase_05 | AC | 73 ms
71,140 KB |
testcase_06 | AC | 72 ms
71,440 KB |
testcase_07 | AC | 72 ms
71,300 KB |
testcase_08 | AC | 562 ms
79,564 KB |
testcase_09 | AC | 540 ms
79,928 KB |
testcase_10 | AC | 575 ms
79,584 KB |
testcase_11 | AC | 555 ms
79,916 KB |
testcase_12 | AC | 673 ms
81,020 KB |
testcase_13 | AC | 738 ms
80,728 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])