結果
問題 | No.1340 おーじ君をさがせ |
ユーザー | titia |
提出日時 | 2021-01-15 23:14:06 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,071 bytes |
コンパイル時間 | 360 ms |
コンパイル使用メモリ | 86,992 KB |
実行使用メモリ | 88,396 KB |
最終ジャッジ日時 | 2023-08-17 20:06:37 |
合計ジャッジ時間 | 11,727 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 86 ms
80,832 KB |
testcase_01 | AC | 85 ms
76,332 KB |
testcase_02 | AC | 78 ms
71,484 KB |
testcase_03 | AC | 82 ms
75,464 KB |
testcase_04 | AC | 86 ms
76,336 KB |
testcase_05 | AC | 78 ms
71,304 KB |
testcase_06 | AC | 84 ms
76,304 KB |
testcase_07 | AC | 85 ms
76,284 KB |
testcase_08 | AC | 75 ms
71,240 KB |
testcase_09 | AC | 78 ms
70,980 KB |
testcase_10 | AC | 102 ms
76,816 KB |
testcase_11 | AC | 494 ms
83,908 KB |
testcase_12 | AC | 267 ms
79,224 KB |
testcase_13 | AC | 588 ms
83,104 KB |
testcase_14 | AC | 1,178 ms
88,396 KB |
testcase_15 | AC | 892 ms
84,248 KB |
testcase_16 | AC | 240 ms
78,920 KB |
testcase_17 | AC | 329 ms
79,080 KB |
testcase_18 | AC | 604 ms
83,896 KB |
testcase_19 | AC | 110 ms
76,256 KB |
testcase_20 | AC | 117 ms
77,064 KB |
testcase_21 | AC | 1,484 ms
82,400 KB |
testcase_22 | TLE | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
ソースコード
import sys input = sys.stdin.readline N,M,T=map(int,input().split()) mod=1+(1<<60) # 行列の計算(numpyを使えないとき,modを使用) def prod(A,B,k,l,m):# A:k*l,B:l*m C=[[None for i in range(m)] for j in range(k)] for i in range(k): for j in range(m): ANS=0 for pl in range(l): ANS=(ANS+A[i][pl]*B[pl][j])%mod C[i][j]=ANS return C def plus(A,B,k,l):# a,B:k*l C=[[None for i in range(l)] for j in range(k)] for i in range(k): for j in range(l): C[i][j]=(A[i][j]+B[i][j])%mod return C A=[[0]*N for i in range(N)] for i in range(M): a,b=map(int,input().split()) A[a][b]=1 # 漸化式を行列累乗で求める(ダブリング) POWA=[A] for i in range(60): POWA.append(prod(POWA[-1],POWA[-1],N,N,N)) # ベキを求めて X=[[0]*N] X[0][0]=1 #print(X) while T: X=prod(X,POWA[T.bit_length()-1],1,N,N) # n乗の場合 T-=1<<(T.bit_length()-1) #print(X) ANS=0 for i in X[0]: if i>0: ANS+=1 print(ANS)