結果

問題 No.1340 おーじ君をさがせ
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-12 16:32:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 90,684 KB
最終ジャッジ日時 2023-09-26 16:18:50
合計ジャッジ時間 14,364 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,604 KB
testcase_01 AC 74 ms
71,244 KB
testcase_02 AC 75 ms
70,900 KB
testcase_03 AC 73 ms
71,332 KB
testcase_04 WA -
testcase_05 AC 74 ms
71,104 KB
testcase_06 WA -
testcase_07 AC 74 ms
71,308 KB
testcase_08 AC 74 ms
71,256 KB
testcase_09 AC 75 ms
71,200 KB
testcase_10 AC 85 ms
76,004 KB
testcase_11 AC 89 ms
76,180 KB
testcase_12 WA -
testcase_13 AC 81 ms
75,948 KB
testcase_14 AC 89 ms
76,068 KB
testcase_15 AC 80 ms
75,436 KB
testcase_16 AC 93 ms
76,028 KB
testcase_17 AC 80 ms
75,516 KB
testcase_18 AC 77 ms
75,528 KB
testcase_19 AC 80 ms
75,748 KB
testcase_20 AC 83 ms
75,824 KB
testcase_21 AC 210 ms
78,064 KB
testcase_22 AC 353 ms
78,028 KB
testcase_23 AC 203 ms
78,008 KB
testcase_24 AC 570 ms
78,056 KB
testcase_25 AC 124 ms
77,924 KB
testcase_26 AC 119 ms
78,140 KB
testcase_27 AC 115 ms
78,032 KB
testcase_28 AC 130 ms
78,040 KB
testcase_29 AC 113 ms
78,052 KB
testcase_30 AC 217 ms
78,132 KB
testcase_31 AC 592 ms
90,684 KB
testcase_32 AC 116 ms
77,964 KB
testcase_33 AC 115 ms
78,140 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 74 ms
71,116 KB
testcase_37 AC 110 ms
77,940 KB
testcase_38 WA -
testcase_39 AC 457 ms
77,972 KB
testcase_40 AC 461 ms
85,380 KB
testcase_41 AC 464 ms
85,484 KB
testcase_42 WA -
testcase_43 AC 77 ms
71,172 KB
testcase_44 AC 74 ms
71,260 KB
testcase_45 AC 76 ms
71,068 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 332 ms
78,060 KB
testcase_49 AC 453 ms
86,928 KB
testcase_50 AC 454 ms
86,700 KB
testcase_51 AC 448 ms
86,912 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 77 ms
71,216 KB
testcase_57 AC 73 ms
71,332 KB
testcase_58 AC 76 ms
71,208 KB
testcase_59 WA -
testcase_60 AC 76 ms
71,112 KB
testcase_61 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main0(n,m,t,ab):
  # 愚直。ダブリング。O(n^2)
  g=[set() for _ in range(n)]
  for a,b in ab:
    a,b=a-1,b-1
    g[a].add(b)
  ary=[[set()]*60 for _ in range(n)]
  # ary[v][k]:頂点vの2^k秒後にいる可能性のある頂点の集合
  for v in range(n):ary[v][0]=g[v]
  for k in range(1,60):
    for v in range(n):
      tmp=set()
      for u in ary[v][k-1]:
        tmp|=ary[u][k-1]
      ary[v][k]=tmp
  now={0}
  for i in range(60):
    if t&(1<<i):
      nxt=set()
      for v in now:
        nxt|=ary[v][i]
      now=nxt
  return len(now)

if __name__=='__main__':
  n,m,t=map(int,input().split())
  ab=[list(map(int,input().split())) for _ in range(m)]
  ret0=main0(n,m,t,ab)
  print(ret0)
0