<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2021-10-01T08:35:37+00:00</updated><id>/feed.xml</id><title type="html">kkoronaDev</title><subtitle>Web / UI / UX / Data Engineering / Algorithm</subtitle><entry><title type="html">Skyline 해설</title><link href="/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98/%EB%AC%B8%EC%A0%9C%EC%84%A4%EB%AA%85/2021/10/01/Skyline.html" rel="alternate" type="text/html" title="Skyline 해설" /><published>2021-10-01T08:35:00+00:00</published><updated>2021-10-01T08:35:00+00:00</updated><id>/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98/%EB%AC%B8%EC%A0%9C%EC%84%A4%EB%AA%85/2021/10/01/Skyline</id><content type="html" xml:base="/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98/%EB%AC%B8%EC%A0%9C%EC%84%A4%EB%AA%85/2021/10/01/Skyline.html">&lt;p&gt;Skyline의 해설입니다.&lt;/p&gt;

&lt;h2 id=&quot;개요&quot;&gt;개요&lt;/h2&gt;

&lt;p&gt;Skyline은 주어진 빌딩의 정보를 조합하여 최종적으로 만들어지는 공제선을 구해 출력하는 문제입니다.&lt;/p&gt;

&lt;p&gt;개별적으로 입력되는 정보를 종합하여 만들어진 최종 결과를 출력해야 한다는 점에서 색종이(KOI 07’ 초등부 2번)와 유사한 문제라고 볼 수 있습니다.&lt;/p&gt;

&lt;h2 id=&quot;문제-접근&quot;&gt;문제 접근&lt;/h2&gt;

&lt;p&gt;건물이 가지는 정보는 시작점, 넓이 , 높이입니다.
문제에서 요구하는 것은 공제선의 구성 정보(가로, 세로 선분)이므로 결국 최종적으로 만들어지는 공제선이 어떻게 되어있는지를 건물의 정보를 이용하여 구해야 합니다.&lt;/p&gt;

&lt;p&gt;따라서 ‘공제선을 어떻게 표현할 것인가?’가 문제 해결의 핵심이 되겠습니다.&lt;/p&gt;

&lt;h3 id=&quot;배열로-표현하기&quot;&gt;배열로 표현하기&lt;/h3&gt;

&lt;p&gt;먼저 공제선을 1,000,000 개 크기의 1차원 배열로 표현할 수 있겠습니다. 이러면 공제선을 읽는 시간은 느리겠지만 건물의 입력에 따른 공제선 정보 변경을 간단하게 처리할 수 있습니다. 원래 문제에서 요구하는 답안도 해당 형태입니다.&lt;/p&gt;

&lt;h3 id=&quot;점의-배열로-표현하기&quot;&gt;점의 배열로 표현하기&lt;/h3&gt;

&lt;p&gt;본 문제에서 별도의 메모리 제한이 없기 때문에 위 솔루션이 가능합니다만, 만약 메모리 제한이 있거나 가로의 범위가 INT_MAX와 같이 매우 큰 수라면 배열을 그대로 공제선으로 구현하기엔 제한이 생길 수 있습니다.&lt;/p&gt;

&lt;p&gt;따라서 정석적인 풀이법은 공제선을 구성하는 각 점의 배열로 공제선을 표현하는 것입니다. priority_queue나 multiset과 같은 자료형을 사용하는 솔루션입니다.&lt;/p&gt;

&lt;p&gt;이러한 풀이는 건물을 두 개의 요소 - &lt;em&gt;시작점&lt;/em&gt; 과 &lt;em&gt;끝점&lt;/em&gt; 으로 분리하여 이용합니다. 공제선의 정보가 변하는 지점은 결국 건물이 시작하고 끝나는 지점들 뿐이기 때문입니다.&lt;/p&gt;

&lt;p&gt;이후 해당 지점들을 끝점 우선, x좌표 오름차순, 동일 x좌표에 대해 y좌표 내림차순으로 정렬하여 공제선의 구성점을 찾아낼 수 있습니다. 이러한 기법을 &lt;strong&gt;스위핑 알고리즘&lt;/strong&gt;이라고 합니다.&lt;/p&gt;

&lt;h2 id=&quot;총평&quot;&gt;총평&lt;/h2&gt;

&lt;p&gt;구현에 있어서 꽤 까다롭게 느껴질 수 있는 문제입니다. 다만 NESPA는 제한 조건이 널널하게 설정되어있기 때문에 배열을 이용한 풀이를 충분히 생각해볼 수 있어 고급 자료구조를 활용하지 않아도 100점을 무난히 받을 수 있는 문제라고 생각합니다.&lt;/p&gt;</content><author><name></name></author><category term="자료구조" /><category term="알고리즘" /><category term="문제설명" /><summary type="html">Skyline의 해설입니다.</summary></entry><entry><title type="html">Welcome to Jekyll!</title><link href="/jekyll/update/2019/01/03/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2019-01-03T01:16:59+00:00</published><updated>2019-01-03T01:16:59+00:00</updated><id>/jekyll/update/2019/01/03/welcome-to-jekyll</id><content type="html" xml:base="/jekyll/update/2019/01/03/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;

&lt;p&gt;To add new posts, simply add a file in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory that follows the convention &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;YYYY-MM-DD-name-of-post.ext&lt;/code&gt; and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.&lt;/p&gt;

&lt;p&gt;Jekyll also offers powerful support for code snippets:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hi, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Tom'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#=&amp;gt; prints 'Hi, Tom' to STDOUT.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Check out the &lt;a href=&quot;https://jekyllrb.com/docs/home&quot;&gt;Jekyll docs&lt;/a&gt; for more info on how to get the most out of Jekyll. File all bugs/feature requests at &lt;a href=&quot;https://github.com/jekyll/jekyll&quot;&gt;Jekyll’s GitHub repo&lt;/a&gt;. If you have questions, you can ask them on &lt;a href=&quot;https://talk.jekyllrb.com/&quot;&gt;Jekyll Talk&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><category term="jekyll" /><category term="update" /><summary type="html">You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.</summary></entry></feed>