<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>tomerun</author_name>
  <author_url>https://blog.hatena.ne.jp/tomerun/</author_url>
  <blog_title>TopCoderの学習のお時間</blog_title>
  <blog_url>https://topcoder-tomerun.hatenablog.jp/</blog_url>
  <categories>
  </categories>
  <description>あまり広まっておらず知る人ぞ知るテクみたいになってる気がしたので。グリッド上でBFSをするときに、単純に書くとこのような感じになると思います。 bool bfs(const vector&lt;vector&lt;int&gt;&gt;&amp; grid, int r, int c) { vector&lt;pair&lt;int, int&gt;&gt; queue = { {r, c} }; vector&lt;vector&lt;bool&gt;&gt; visited(H, vector&lt;bool&gt;(W)); visited[r][c] = true; int qi = 0; while (qi &lt; queue.size()) { auto [cr, cc] =…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftopcoder-tomerun.hatenablog.jp%2Fentry%2F2022%2F11%2F06%2F145156&quot; title=&quot;BFSを繰り返すときに訪問済みかを記録する配列を毎回初期化しなくて良くするアレ - TopCoderの学習のお時間&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>2022-11-06 14:51:56</published>
  <title>BFSを繰り返すときに訪問済みかを記録する配列を毎回初期化しなくて良くするアレ</title>
  <type>rich</type>
  <url>https://topcoder-tomerun.hatenablog.jp/entry/2022/11/06/145156</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
