結果

問題 No.1340 おーじ君をさがせ
ユーザー ああいいああいい
提出日時 2022-03-12 16:57:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 77,168 KB
最終ジャッジ日時 2023-10-17 02:00:54
合計ジャッジ時間 13,523 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,556 KB
testcase_01 AC 36 ms
53,556 KB
testcase_02 AC 36 ms
53,556 KB
testcase_03 AC 36 ms
53,556 KB
testcase_04 AC 36 ms
53,556 KB
testcase_05 AC 37 ms
53,556 KB
testcase_06 AC 36 ms
53,556 KB
testcase_07 AC 36 ms
53,556 KB
testcase_08 AC 36 ms
53,556 KB
testcase_09 AC 35 ms
53,556 KB
testcase_10 AC 49 ms
64,068 KB
testcase_11 AC 226 ms
75,636 KB
testcase_12 AC 79 ms
72,440 KB
testcase_13 AC 99 ms
75,572 KB
testcase_14 AC 169 ms
75,684 KB
testcase_15 AC 149 ms
75,624 KB
testcase_16 AC 78 ms
70,400 KB
testcase_17 AC 86 ms
75,524 KB
testcase_18 AC 113 ms
75,584 KB
testcase_19 AC 53 ms
66,268 KB
testcase_20 AC 54 ms
66,148 KB
testcase_21 AC 199 ms
76,448 KB
testcase_22 AC 408 ms
76,500 KB
testcase_23 AC 201 ms
76,480 KB
testcase_24 AC 690 ms
77,136 KB
testcase_25 AC 91 ms
76,200 KB
testcase_26 AC 85 ms
76,172 KB
testcase_27 AC 84 ms
76,096 KB
testcase_28 AC 98 ms
76,104 KB
testcase_29 AC 70 ms
73,288 KB
testcase_30 AC 212 ms
76,472 KB
testcase_31 AC 688 ms
77,024 KB
testcase_32 AC 348 ms
76,960 KB
testcase_33 AC 338 ms
76,948 KB
testcase_34 AC 540 ms
76,696 KB
testcase_35 AC 642 ms
76,980 KB
testcase_36 AC 37 ms
53,556 KB
testcase_37 AC 65 ms
72,908 KB
testcase_38 AC 370 ms
77,168 KB
testcase_39 AC 188 ms
76,440 KB
testcase_40 AC 174 ms
76,580 KB
testcase_41 AC 178 ms
76,584 KB
testcase_42 AC 41 ms
59,708 KB
testcase_43 AC 40 ms
59,180 KB
testcase_44 AC 44 ms
61,784 KB
testcase_45 AC 43 ms
59,728 KB
testcase_46 AC 235 ms
76,632 KB
testcase_47 AC 254 ms
76,632 KB
testcase_48 AC 275 ms
76,632 KB
testcase_49 AC 152 ms
75,776 KB
testcase_50 AC 161 ms
75,780 KB
testcase_51 AC 162 ms
75,776 KB
testcase_52 AC 187 ms
75,848 KB
testcase_53 AC 187 ms
75,820 KB
testcase_54 AC 192 ms
75,848 KB
testcase_55 AC 334 ms
76,780 KB
testcase_56 AC 44 ms
59,744 KB
testcase_57 AC 43 ms
59,744 KB
testcase_58 AC 37 ms
53,556 KB
testcase_59 AC 100 ms
75,692 KB
testcase_60 AC 37 ms
53,556 KB
testcase_61 AC 103 ms
75,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,T = map(int,input().split())
R = [[0] * N for _ in range(N)]
for _ in range(M):
    a,b = map(int,input().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):
                if x[i][k] and y[k][j]:
                    l[i][j] = 1
    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