結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 terry_u16terry_u16
提出日時 2021-01-15 22:48:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,365 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 84,300 KB
最終ジャッジ日時 2023-08-18 16:43:01
合計ジャッジ時間 22,314 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,168 KB
testcase_01 AC 76 ms
75,848 KB
testcase_02 AC 71 ms
71,208 KB
testcase_03 AC 73 ms
71,324 KB
testcase_04 AC 77 ms
76,184 KB
testcase_05 AC 72 ms
71,328 KB
testcase_06 AC 73 ms
71,256 KB
testcase_07 AC 76 ms
75,224 KB
testcase_08 AC 72 ms
71,176 KB
testcase_09 AC 71 ms
71,180 KB
testcase_10 AC 85 ms
76,320 KB
testcase_11 AC 101 ms
76,584 KB
testcase_12 AC 132 ms
76,448 KB
testcase_13 AC 89 ms
76,476 KB
testcase_14 AC 101 ms
76,528 KB
testcase_15 AC 92 ms
76,364 KB
testcase_16 AC 124 ms
76,844 KB
testcase_17 AC 86 ms
76,608 KB
testcase_18 AC 89 ms
76,484 KB
testcase_19 AC 82 ms
76,592 KB
testcase_20 AC 85 ms
76,204 KB
testcase_21 AC 270 ms
79,280 KB
testcase_22 AC 540 ms
81,224 KB
testcase_23 AC 258 ms
79,296 KB
testcase_24 AC 914 ms
83,860 KB
testcase_25 AC 125 ms
77,848 KB
testcase_26 AC 116 ms
77,908 KB
testcase_27 AC 115 ms
77,456 KB
testcase_28 AC 134 ms
78,060 KB
testcase_29 AC 105 ms
77,304 KB
testcase_30 AC 284 ms
79,384 KB
testcase_31 AC 913 ms
83,616 KB
testcase_32 AC 137 ms
83,740 KB
testcase_33 AC 136 ms
83,668 KB
testcase_34 AC 386 ms
83,520 KB
testcase_35 AC 392 ms
83,588 KB
testcase_36 AC 71 ms
71,176 KB
testcase_37 AC 96 ms
76,832 KB
testcase_38 AC 124 ms
84,160 KB
testcase_39 AC 1,357 ms
83,924 KB
testcase_40 AC 1,349 ms
84,300 KB
testcase_41 AC 1,289 ms
83,900 KB
testcase_42 AC 70 ms
75,840 KB
testcase_43 AC 74 ms
76,284 KB
testcase_44 AC 73 ms
75,756 KB
testcase_45 AC 76 ms
76,064 KB
testcase_46 AC 1,080 ms
84,060 KB
testcase_47 AC 1,093 ms
83,736 KB
testcase_48 AC 1,077 ms
83,904 KB
testcase_49 AC 1,307 ms
82,448 KB
testcase_50 AC 1,332 ms
82,320 KB
testcase_51 AC 1,365 ms
82,116 KB
testcase_52 AC 106 ms
76,552 KB
testcase_53 AC 106 ms
76,592 KB
testcase_54 AC 107 ms
76,428 KB
testcase_55 AC 575 ms
84,020 KB
testcase_56 AC 78 ms
76,108 KB
testcase_57 AC 77 ms
76,372 KB
testcase_58 AC 71 ms
71,316 KB
testcase_59 AC 138 ms
82,264 KB
testcase_60 AC 71 ms
71,164 KB
testcase_61 AC 140 ms
82,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, edgeCount, timeLimit = map(int, input().split())
doubling = [[[False] * n for _ in range(n)] for _ in range(61)]

for _ in range(edgeCount):
    u, v = map(int, input().split())
    doubling[0][u][v] = True

for d in range(60):
    for u in range(n):
        for v in range(n):
            if not doubling[d][u][v]:
                continue

            for w in range(n):
                doubling[d + 1][u][w] |= doubling[d][v][w]

current = [False] * n
current[0] = True

for d in range(60):
    if ((timeLimit >> d) & 1) > 0:
        nxt = [False] * n
        for u in range(n):
            if current[u]:
                for v in range(n):
                    nxt[v] |= doubling[d][u][v]
        current = nxt

count = 0

for v in range(n):
    if current[v]:
        count += 1

print(count)
0