結果
問題 | No.1340 おーじ君をさがせ |
ユーザー |
![]() |
提出日時 | 2021-01-16 04:06:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 780 bytes |
コンパイル時間 | 413 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,832 KB |
最終ジャッジ日時 | 2024-11-27 23:29:29 |
合計ジャッジ時間 | 32,266 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 59 |
ソースコード
mod = 1+(1<<30)def main():n, m, t = map(int, input().split())A = [[0]*n for i in range(n)]for i in range(m):a, b = map(int, input().split())A[b][a] = 1#print(A)# A*Bimport numpy as np#A**ndef mat_pow(A, n, mod):size = len(A)res = np.eye(size, dtype=np.object)while n > 0:if n & 1 == 1:res = res @ Ares %= modA = A @ AA %= modn = n>>1return resX = [0]*nX[0] = 1X = np.array(X)A = np.array(A)A = mat_pow(A, t, mod)ans = 0for i in range(n):s = A[i]@Xif s:ans += 1#print(A)print(ans)if __name__ == '__main__':main()