結果
問題 | No.1750 ラムドスウイルスの感染拡大-hard |
ユーザー | kys |
提出日時 | 2021-11-19 22:17:18 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,141 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 87,164 KB |
実行使用メモリ | 101,132 KB |
最終ジャッジ日時 | 2023-08-30 08:54:47 |
合計ジャッジ時間 | 8,807 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
76,036 KB |
testcase_01 | AC | 70 ms
71,268 KB |
testcase_02 | AC | 74 ms
75,412 KB |
testcase_03 | AC | 81 ms
76,408 KB |
testcase_04 | AC | 184 ms
78,192 KB |
testcase_05 | AC | 71 ms
71,188 KB |
testcase_06 | AC | 70 ms
71,340 KB |
testcase_07 | AC | 74 ms
71,348 KB |
testcase_08 | AC | 574 ms
79,744 KB |
testcase_09 | AC | 542 ms
79,852 KB |
testcase_10 | AC | 567 ms
80,080 KB |
testcase_11 | AC | 558 ms
80,620 KB |
testcase_12 | AC | 672 ms
81,516 KB |
testcase_13 | AC | 744 ms
80,972 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.readline def iinput(): return int(input()) def sinput(): return input().rstrip() def i0input(): return int(input()) - 1 def linput(): return list(input().split()) def liinput(): return list(map(int, input().split())) def miinput(): return map(int, input().split()) def li0input(): return list(map(lambda x: int(x) - 1, input().split())) def mi0input(): return map(lambda x: int(x) - 1, input().split()) INF = 10**20 MOD = 998244353 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 N, M, T = liinput() g = [[0 for _ in range(N)] for _ in range(N)] for _ in [0] * M: s, t = liinput() g[s][t] = 1 g[t][s] = 1 ans = mat_pow(g, T) print(ans[0][0])