結果

問題 No.1340 おーじ君をさがせ
ユーザー Chippppp
提出日時 2021-08-15 21:04:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 271 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,056 KB
最終ジャッジ日時 2024-10-08 05:38:36
合計ジャッジ時間 31,803 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 59
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n, m, t = map(int, input().split())
p = np.zeros((n, n), dtype = np.bool)
for _ in range(m):
  a, b = map(int, input().split())
  p[b][a] = 1
q = np.zeros((n, 1), dtype = np.bool)
q[0][0] = 1
print(sum(i[0] for i in (q @ np.linalg.matrix_power(p, n))))
0