<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>thescript1210</author_name>
  <author_url>https://blog.hatena.ne.jp/thescript1210/</author_url>
  <blog_title>ひらめの日常</blog_title>
  <blog_url>https://hiramekun.hatenablog.com/</blog_url>
  <categories>
    <anon>競技プログラミング</anon>
    <anon>解法メモ</anon>
    <anon>codeforces</anon>
    <anon>union_find</anon>
    <anon>クエリ先読み</anon>
  </categories>
  <description>問題はこちら codeforces.com 頂点数 の木が与えられる（木なので辺の数は ）。 以下のような 個のクエリ が投げられるので、それぞれに対する答えを出力せよ。 求めるものは以下を満たす頂点 , , のペアの個数。 頂点 と を結ぶパスの中で、辺の最大の重みが を超えない。 考え方 以下のみの辺で連結になっている頂点数 が分かれば、その中を結ぶ頂点のペアの個数は だとわかる。よって、重み 以下の辺が出てきたら、その二つの頂点を同じグループに入れればいい。 このようなグループの構成は Union find木 を使えばいいということがわかる。 愚直に全てのクエリに対して順番にやると、毎回…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhiramekun.hatenablog.com%2Fentry%2F2019%2F08%2F31%2F202550&quot; title=&quot;Codeforces Round #582 (Div. 3) G. Path Queries - ひらめの日常&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>https://cdn.blog.st-hatena.com/images/theme/og-image-1500.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-08-31 20:25:50</published>
  <title>Codeforces Round #582 (Div. 3) G. Path Queries</title>
  <type>rich</type>
  <url>https://hiramekun.hatenablog.com/entry/2019/08/31/202550</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
