結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー |
![]() |
提出日時 | 2022-06-24 01:00:01 |
言語 | PyPy3 (7.3.8) |
結果 |
TLE
|
実行時間 | - |
コード長 | 732 Byte |
コンパイル時間 | 485 ms |
使用メモリ | 101,948 KB |
最終ジャッジ日時 | 2022-06-24 01:00:10 |
合計ジャッジ時間 | 8,985 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
75,620 KB |
testcase_01 | AC | 74 ms
75,632 KB |
testcase_02 | AC | 77 ms
80,388 KB |
testcase_03 | AC | 84 ms
80,540 KB |
testcase_04 | AC | 204 ms
82,428 KB |
testcase_05 | AC | 84 ms
75,540 KB |
testcase_06 | AC | 80 ms
75,648 KB |
testcase_07 | AC | 72 ms
75,716 KB |
testcase_08 | AC | 563 ms
84,264 KB |
testcase_09 | AC | 501 ms
84,068 KB |
testcase_10 | AC | 527 ms
84,240 KB |
testcase_11 | AC | 565 ms
84,616 KB |
testcase_12 | AC | 640 ms
85,708 KB |
testcase_13 | AC | 728 ms
85,528 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 | -- | - |
ソースコード
N, M, T = map(int, input().split()) A = [[0]*N for _ in range(N)] for i in range(M): s, t = map(int, input().split()) A[s][t] = 1 A[t][s] = 1 def mat_mul(a, b, mod=998244353) : 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, mod=998244353): 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, mod) x = mat_mul(x, x, mod) n >>= 1 return y res = mat_pow(A, T) print(res[0][0])