結果

問題 No.1340 おーじ君をさがせ
ユーザー rlangevinrlangevin
提出日時 2023-11-21 00:03:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 819 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 82,128 KB
最終ジャッジ日時 2023-11-21 00:03:48
合計ジャッジ時間 11,877 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
60,264 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 34 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 34 ms
53,460 KB
testcase_09 AC 34 ms
53,460 KB
testcase_10 AC 67 ms
75,620 KB
testcase_11 AC 368 ms
75,412 KB
testcase_12 AC 210 ms
76,228 KB
testcase_13 AC 432 ms
76,064 KB
testcase_14 AC 1,402 ms
81,700 KB
testcase_15 AC 625 ms
75,540 KB
testcase_16 AC 181 ms
75,996 KB
testcase_17 AC 228 ms
75,412 KB
testcase_18 AC 373 ms
75,412 KB
testcase_19 AC 56 ms
64,148 KB
testcase_20 AC 66 ms
75,468 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def Matprod(A, B, mod, N):
    temp = [0] * N*N
    for i in range(N):
        for j in range(N):
            ij = i * N + j
            for k in range(N):
                temp[ij] += A[i*N+k] * B[k*N+j]
                temp[ij] %= mod
    return temp

def Matpow_Linear(A, M, mod, N):
    Mat = [0] * N*N
    for i in range(N):
        Mat[i*N+i] = 1
         
    while M:
        if M & 1:
            Mat = Matprod(Mat, A, mod, N)
        A = Matprod(A, A, mod, N)
        M >>= 1
    return Mat  

N, M, T = map(int, input().split())
N2 = N * N
dp = [0] * N2
for i in range(M):
    a, b = map(int, input().split())
    dp[a*N+b] += 1
    
mod = 100000000000000003
dp = Matpow_Linear(dp, T, mod, N)
ans = 0
for i in range(N):
    if dp[i]:
        ans += 1
        
print(ans)
0