結果

問題 No.1340 おーじ君をさがせ
ユーザー ああいいああいい
提出日時 2022-03-12 16:59:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 787 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 81,748 KB
実行使用メモリ 76,864 KB
最終ジャッジ日時 2023-10-17 02:03:45
合計ジャッジ時間 15,366 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,544 KB
testcase_01 AC 37 ms
53,544 KB
testcase_02 AC 37 ms
53,544 KB
testcase_03 AC 37 ms
53,544 KB
testcase_04 AC 37 ms
53,544 KB
testcase_05 AC 38 ms
53,544 KB
testcase_06 AC 37 ms
53,544 KB
testcase_07 AC 38 ms
53,544 KB
testcase_08 AC 36 ms
53,544 KB
testcase_09 AC 40 ms
53,544 KB
testcase_10 AC 50 ms
64,112 KB
testcase_11 AC 188 ms
75,640 KB
testcase_12 AC 71 ms
68,372 KB
testcase_13 AC 157 ms
75,616 KB
testcase_14 AC 336 ms
75,720 KB
testcase_15 AC 288 ms
75,708 KB
testcase_16 AC 68 ms
68,372 KB
testcase_17 AC 131 ms
75,568 KB
testcase_18 AC 193 ms
75,664 KB
testcase_19 AC 57 ms
66,324 KB
testcase_20 AC 48 ms
62,052 KB
testcase_21 AC 196 ms
75,936 KB
testcase_22 AC 430 ms
76,252 KB
testcase_23 AC 196 ms
75,936 KB
testcase_24 AC 783 ms
76,504 KB
testcase_25 AC 72 ms
74,344 KB
testcase_26 AC 65 ms
72,848 KB
testcase_27 AC 63 ms
70,800 KB
testcase_28 AC 82 ms
75,856 KB
testcase_29 AC 51 ms
66,556 KB
testcase_30 AC 211 ms
75,948 KB
testcase_31 AC 787 ms
76,860 KB
testcase_32 AC 717 ms
76,528 KB
testcase_33 AC 713 ms
76,524 KB
testcase_34 AC 649 ms
76,516 KB
testcase_35 AC 785 ms
76,764 KB
testcase_36 AC 37 ms
53,544 KB
testcase_37 AC 46 ms
64,248 KB
testcase_38 AC 785 ms
76,864 KB
testcase_39 AC 242 ms
76,168 KB
testcase_40 AC 252 ms
76,168 KB
testcase_41 AC 251 ms
76,172 KB
testcase_42 AC 41 ms
59,840 KB
testcase_43 AC 42 ms
59,840 KB
testcase_44 AC 47 ms
62,056 KB
testcase_45 AC 44 ms
62,044 KB
testcase_46 AC 199 ms
76,188 KB
testcase_47 AC 210 ms
76,188 KB
testcase_48 AC 226 ms
76,188 KB
testcase_49 AC 221 ms
75,776 KB
testcase_50 AC 221 ms
75,776 KB
testcase_51 AC 221 ms
75,780 KB
testcase_52 AC 370 ms
75,756 KB
testcase_53 AC 365 ms
75,772 KB
testcase_54 AC 370 ms
75,756 KB
testcase_55 AC 303 ms
76,184 KB
testcase_56 AC 43 ms
59,848 KB
testcase_57 AC 43 ms
59,848 KB
testcase_58 AC 37 ms
53,544 KB
testcase_59 AC 145 ms
72,664 KB
testcase_60 AC 37 ms
53,544 KB
testcase_61 AC 147 ms
73,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
rr = sys.stdin

N,M,T = map(int,rr.readline().split())
R = [[0] * N for _ in range(N)]
for _ in range(M):
    a,b = map(int,rr.readline().split())
    R[b][a] = 1
def seki(x,y):
    l = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            for k in range(N):
                l[i][j] |= x[i][k] & y[k][j]
    return l
tmp = [[0] * N for _ in range(N)]
for i in range(N):
    tmp[i][i] = 1
while T:
    if T & 1:
        tmp = seki(tmp,R)
    T >>= 1
    R = seki(R,R)
ans = 0
for i in range(N):
    ans += tmp[i][0]
print(ans)
0