<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hewla</author_name>
  <author_url>https://blog.hatena.ne.jp/hewla/</author_url>
  <blog_title>Hewlaの競プロ記</blog_title>
  <blog_url>https://hewla.hatenablog.com/</blog_url>
  <categories>
    <anon>解説</anon>
  </categories>
  <description>500点です。 問題リンク結局何を求めればいいのかの考察はすぐ終わりましたが、それをどう実装するのかでそれなりに詰まりました。 解説 「子孫へ有向辺を引く」とあります。このことから、新しい辺を引くことによって、根からその頂点への最短距離は短くなった、ということが言えます。つまり、各頂点への最長経路で通る辺が元の木というわけです。 これを実装します。トポロジカルソートを用いた解法がわかりやすくてよいと聞きましたが、今回は自分が採用したBFS(幅優先探索)を用いた解法を解説します。トポロジカルソートは名前しか知りませんでした。 最長経路の探索はよくわかりませんが、最短経路ならできます。辺に重みがな…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhewla.hatenablog.com%2Fentry%2F2019%2F01%2F27%2F231121&quot; title=&quot;Restore the Tree - AtCoder 全国統一プログラミング王決定戦予選/NIKKEI Programming Contest 2019 D - Hewlaの競プロ記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-01-27 23:11:21</published>
  <title>Restore the Tree - AtCoder 全国統一プログラミング王決定戦予選/NIKKEI Programming Contest 2019 D</title>
  <type>rich</type>
  <url>https://hewla.hatenablog.com/entry/2019/01/27/231121</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
