<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>moistx</author_name>
  <author_url>https://blog.hatena.ne.jp/moistx/</author_url>
  <blog_title>Logfiles</blog_title>
  <blog_url>https://logfiles.hatenablog.com/</blog_url>
  <categories>
    <anon>UVa</anon>
  </categories>
  <description>問題 入力のの順番で、グリッドを渦状に埋め尽くすようにボールを埋める。ただし同じ列は同じ色である必要がある。 グリッドのサイズを N*M としたとき、最大の N+M を求めよ。条件を満たす N,M が存在しない場合は -1 を出力せよ。解法 ぐるぐる巻きを実装するだけ。次に曲がる位置までの長さを計算するより、「枠外と衝突」or「既に置いたところと衝突」のタイミングで曲がるよう実装する方がミスなく書ける。以下のコードでは 二重ループと memset で O(N^2 * M^2) になっているように見えるが、N*M = SIZE を満たす組が限定されるので間に合う。 #include &lt;bits/…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Flogfiles.hatenablog.com%2Fentry%2F20140826%2F1409061009&quot; title=&quot;UVa12337 Bob’s Beautiful Balls - Logfiles&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>2014-08-26 22:50:09</published>
  <title>UVa12337 Bob’s Beautiful Balls</title>
  <type>rich</type>
  <url>https://logfiles.hatenablog.com/entry/20140826/1409061009</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
