結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 terry_u16terry_u16
提出日時 2021-01-15 22:48:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,307 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 82,284 KB
最終ジャッジ日時 2024-05-05 21:55:13
合計ジャッジ時間 19,309 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
60,160 KB
testcase_01 AC 40 ms
59,136 KB
testcase_02 AC 37 ms
52,608 KB
testcase_03 AC 37 ms
52,224 KB
testcase_04 AC 44 ms
60,160 KB
testcase_05 AC 39 ms
52,608 KB
testcase_06 AC 38 ms
52,864 KB
testcase_07 AC 42 ms
58,992 KB
testcase_08 AC 38 ms
52,096 KB
testcase_09 AC 35 ms
52,600 KB
testcase_10 AC 53 ms
63,616 KB
testcase_11 AC 72 ms
68,352 KB
testcase_12 AC 100 ms
69,376 KB
testcase_13 AC 57 ms
66,432 KB
testcase_14 AC 69 ms
68,736 KB
testcase_15 AC 59 ms
67,456 KB
testcase_16 AC 91 ms
71,680 KB
testcase_17 AC 54 ms
64,768 KB
testcase_18 AC 57 ms
66,176 KB
testcase_19 AC 49 ms
62,848 KB
testcase_20 AC 53 ms
62,848 KB
testcase_21 AC 229 ms
78,412 KB
testcase_22 AC 473 ms
80,256 KB
testcase_23 AC 222 ms
78,080 KB
testcase_24 AC 833 ms
81,920 KB
testcase_25 AC 96 ms
77,056 KB
testcase_26 AC 92 ms
76,544 KB
testcase_27 AC 87 ms
76,416 KB
testcase_28 AC 109 ms
77,092 KB
testcase_29 AC 73 ms
73,984 KB
testcase_30 AC 246 ms
78,336 KB
testcase_31 AC 830 ms
81,920 KB
testcase_32 AC 112 ms
81,824 KB
testcase_33 AC 112 ms
82,012 KB
testcase_34 AC 355 ms
81,896 KB
testcase_35 AC 349 ms
81,536 KB
testcase_36 AC 37 ms
52,224 KB
testcase_37 AC 67 ms
72,704 KB
testcase_38 AC 100 ms
82,016 KB
testcase_39 AC 1,246 ms
82,284 KB
testcase_40 AC 1,231 ms
81,984 KB
testcase_41 AC 1,307 ms
81,972 KB
testcase_42 AC 42 ms
59,264 KB
testcase_43 AC 43 ms
59,264 KB
testcase_44 AC 42 ms
59,008 KB
testcase_45 AC 42 ms
59,008 KB
testcase_46 AC 980 ms
81,792 KB
testcase_47 AC 994 ms
82,176 KB
testcase_48 AC 1,012 ms
82,032 KB
testcase_49 AC 1,270 ms
81,268 KB
testcase_50 AC 1,258 ms
81,372 KB
testcase_51 AC 1,301 ms
81,484 KB
testcase_52 AC 77 ms
71,424 KB
testcase_53 AC 77 ms
71,296 KB
testcase_54 AC 77 ms
71,424 KB
testcase_55 AC 520 ms
82,124 KB
testcase_56 AC 46 ms
60,544 KB
testcase_57 AC 47 ms
60,288 KB
testcase_58 AC 38 ms
52,352 KB
testcase_59 AC 101 ms
72,576 KB
testcase_60 AC 37 ms
52,736 KB
testcase_61 AC 101 ms
73,472 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