結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 rin204rin204
提出日時 2022-03-24 15:55:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 774 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 79,488 KB
最終ジャッジ日時 2024-04-21 01:47:30
合計ジャッジ時間 14,901 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,760 KB
testcase_01 AC 42 ms
53,760 KB
testcase_02 AC 42 ms
53,632 KB
testcase_03 AC 42 ms
53,504 KB
testcase_04 AC 42 ms
53,760 KB
testcase_05 AC 42 ms
53,248 KB
testcase_06 AC 41 ms
53,376 KB
testcase_07 AC 43 ms
53,632 KB
testcase_08 AC 41 ms
53,248 KB
testcase_09 AC 41 ms
53,376 KB
testcase_10 AC 81 ms
74,624 KB
testcase_11 AC 188 ms
77,184 KB
testcase_12 AC 104 ms
76,800 KB
testcase_13 AC 169 ms
76,928 KB
testcase_14 AC 335 ms
77,132 KB
testcase_15 AC 281 ms
77,312 KB
testcase_16 AC 100 ms
76,928 KB
testcase_17 AC 142 ms
77,056 KB
testcase_18 AC 196 ms
77,200 KB
testcase_19 AC 79 ms
72,704 KB
testcase_20 AC 70 ms
69,888 KB
testcase_21 AC 223 ms
77,824 KB
testcase_22 AC 429 ms
78,184 KB
testcase_23 AC 218 ms
77,696 KB
testcase_24 AC 717 ms
78,976 KB
testcase_25 AC 116 ms
77,696 KB
testcase_26 AC 109 ms
77,056 KB
testcase_27 AC 109 ms
77,312 KB
testcase_28 AC 123 ms
77,824 KB
testcase_29 AC 104 ms
77,184 KB
testcase_30 AC 237 ms
77,952 KB
testcase_31 AC 774 ms
79,488 KB
testcase_32 AC 666 ms
78,180 KB
testcase_33 AC 656 ms
78,564 KB
testcase_34 AC 627 ms
78,208 KB
testcase_35 AC 675 ms
78,308 KB
testcase_36 AC 42 ms
54,272 KB
testcase_37 AC 76 ms
74,624 KB
testcase_38 AC 719 ms
78,464 KB
testcase_39 AC 244 ms
77,568 KB
testcase_40 AC 237 ms
77,568 KB
testcase_41 AC 251 ms
77,696 KB
testcase_42 AC 43 ms
54,016 KB
testcase_43 AC 48 ms
60,544 KB
testcase_44 AC 61 ms
65,920 KB
testcase_45 AC 55 ms
63,488 KB
testcase_46 AC 212 ms
77,696 KB
testcase_47 AC 223 ms
77,440 KB
testcase_48 AC 239 ms
77,696 KB
testcase_49 AC 228 ms
77,440 KB
testcase_50 AC 236 ms
77,304 KB
testcase_51 AC 237 ms
77,568 KB
testcase_52 AC 365 ms
77,256 KB
testcase_53 AC 366 ms
77,468 KB
testcase_54 AC 364 ms
77,184 KB
testcase_55 AC 306 ms
77,696 KB
testcase_56 AC 51 ms
62,080 KB
testcase_57 AC 49 ms
61,824 KB
testcase_58 AC 43 ms
53,760 KB
testcase_59 AC 142 ms
77,312 KB
testcase_60 AC 41 ms
53,248 KB
testcase_61 AC 163 ms
77,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy

n, m, t = map(int, input().split())
A = [[0] * n for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    A[b][a] = 1
    
B = [0] * n
B[0] = 1
while t:
    if t & 1:
        C = [0] * n
        for i in range(n):
            for j in range(n):
                C[i] |= A[i][j] & B[j]
        B = C[:]
    t >>= 1
    C = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                C[i][j] |= A[i][k] & A[k][j]
    A = deepcopy(C)
print(sum(B))
0