結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー | H3PO4 |
提出日時 | 2021-11-19 21:43:36 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 524 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 10,892 KB |
実行使用メモリ | 51,852 KB |
最終ジャッジ日時 | 2023-08-30 07:54:59 |
合計ジャッジ時間 | 11,109 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 132 ms
33,956 KB |
testcase_01 | AC | 134 ms
29,540 KB |
testcase_02 | AC | 132 ms
29,600 KB |
testcase_03 | AC | 135 ms
29,632 KB |
testcase_04 | AC | 259 ms
30,596 KB |
testcase_05 | AC | 135 ms
29,612 KB |
testcase_06 | AC | 134 ms
29,532 KB |
testcase_07 | AC | 133 ms
29,528 KB |
testcase_08 | AC | 858 ms
32,268 KB |
testcase_09 | AC | 826 ms
32,128 KB |
testcase_10 | AC | 875 ms
32,380 KB |
testcase_11 | AC | 814 ms
32,820 KB |
testcase_12 | AC | 1,150 ms
33,604 KB |
testcase_13 | AC | 1,074 ms
33,744 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 numpy as np N, M, T = map(int, input().split()) MOD = 998244353 def pow_matrix_mod(x, n, mod=MOD): if not n: return np.eye(len(x), dtype=object) if n % 2 == 0: return pow_matrix_mod(x @ x % mod, n // 2) % mod else: return x @ pow_matrix_mod(x @ x % mod, (n - 1) // 2) % mod 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 matr = np.array(matr, dtype=object) print(pow_matrix_mod(matr, T)[0, 0])