Skip to content

Commit

Permalink
Site updated: 2018-03-15 23:07:19
Browse files Browse the repository at this point in the history
  • Loading branch information
hdsdogge committed Mar 15, 2018
1 parent e804348 commit 41ffa81
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 121 deletions.
13 changes: 8 additions & 5 deletions 2018/03/15/Cleaning-Shifts-POJ-2376/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@



<meta name="description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;using namespace std;int N,T;c">
<meta name="description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 还有这题有坑Orz 13 45是可以的 喵喵喵??? 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;us">
<meta name="keywords" content="贪心">
<meta property="og:type" content="article">
<meta property="og:title" content="Cleaning Shifts POJ - 2376 ">
<meta property="og:url" content="http://hdsdogge.me/2018/03/15/Cleaning-Shifts-POJ-2376/index.html">
<meta property="og:site_name" content="每一次AC都是一次感动">
<meta property="og:description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;using namespace std;int N,T;c">
<meta property="og:description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 还有这题有坑Orz 13 45是可以的 喵喵喵??? 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;us">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-03-15T01:13:52.567Z">
<meta property="og:updated_time" content="2018-03-15T15:07:01.692Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Cleaning Shifts POJ - 2376 ">
<meta name="twitter:description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;using namespace std;int N,T;c">
<meta name="twitter:description" content="结构体排序忘了Orz 先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的 话说训练赛又被虐的体无完肤了Orz 还有这题有坑Orz 13 45是可以的 喵喵喵??? 12345678910111213141516171819202122232425262728293031323334353637#include &amp;lt;iostream&amp;gt;#include &amp;lt;algorithm&amp;gt;us">



Expand Down Expand Up @@ -408,7 +408,10 @@ <h1 class="post-title" itemprop="name headline">Cleaning Shifts POJ - 2376 </h1
<p>结构体排序忘了Orz</p>
<p>先排序 然后判断能否完整覆盖棋盘 之后呢在取最远的</p>
<p>话说训练赛又被虐的体无完肤了Orz</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;algorithm&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="keyword">int</span> N,T;</span><br><span class="line"><span class="keyword">const</span> <span class="keyword">int</span> maxn=<span class="number">25005</span>;</span><br><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">node</span>&#123;</span></span><br><span class="line"> <span class="keyword">int</span> s;</span><br><span class="line"> <span class="keyword">int</span> e;</span><br><span class="line">&#125;;</span><br><span class="line"><span class="function"><span class="keyword">bool</span> <span class="title">cmp</span><span class="params">(node a,node b)</span></span>&#123;</span><br><span class="line"> <span class="keyword">return</span> a.s&lt;b.s;</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line"> <span class="comment">//freopen("test","r",stdin);</span></span><br><span class="line"> <span class="keyword">while</span>(<span class="built_in">cin</span>&gt;&gt;N&gt;&gt;T) &#123;</span><br><span class="line"> node n[maxn];</span><br><span class="line"> <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; N; i++)</span><br><span class="line"> <span class="built_in">cin</span> &gt;&gt; n[i].s &gt;&gt; n[i].e;</span><br><span class="line"> sort(n, n + N, cmp);</span><br><span class="line"> <span class="keyword">int</span> temp=<span class="number">1</span>,top=<span class="number">0</span>,ans=<span class="number">0</span>,i=<span class="number">0</span>;</span><br><span class="line"> <span class="keyword">while</span>(temp&lt;T&amp;&amp;i&lt;N)&#123;</span><br><span class="line"> ans++;</span><br><span class="line"> top=temp;</span><br><span class="line"> <span class="keyword">if</span>(n[i].s&gt;temp)</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">while</span>(n[i].s&lt;=temp&amp;&amp;i&lt;N)&#123;</span><br><span class="line"> top=max(n[i].e,top);</span><br><span class="line"> i++;</span><br><span class="line"> &#125;</span><br><span class="line"> temp=top;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span>(temp&lt;T)</span><br><span class="line"> <span class="built_in">cout</span>&lt;&lt;<span class="number">-1</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="built_in">cout</span>&lt;&lt;ans&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>还有这题有坑Orz</p>
<p>13 45是可以的</p>
<p>喵喵喵???</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;algorithm&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="keyword">int</span> N,T;</span><br><span class="line"><span class="keyword">const</span> <span class="keyword">int</span> maxn=<span class="number">25010</span>;</span><br><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">node</span>&#123;</span></span><br><span class="line"> <span class="keyword">int</span> s;</span><br><span class="line"> <span class="keyword">int</span> e;</span><br><span class="line">&#125;;</span><br><span class="line"><span class="function"><span class="keyword">bool</span> <span class="title">cmp</span><span class="params">(node a,node b)</span></span>&#123;</span><br><span class="line"> <span class="keyword">return</span> a.s&lt;b.s;</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line"><span class="comment">// freopen("test","r",stdin);</span></span><br><span class="line"> <span class="keyword">while</span>(<span class="built_in">cin</span>&gt;&gt;N&gt;&gt;T) &#123;</span><br><span class="line"> node n[maxn];</span><br><span class="line"> <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; N; i++)</span><br><span class="line"> <span class="built_in">cin</span> &gt;&gt; n[i].s &gt;&gt; n[i].e;</span><br><span class="line"> sort(n, n + N, cmp);</span><br><span class="line"> <span class="keyword">int</span> temp=<span class="number">0</span>,top=<span class="number">0</span>,ans=<span class="number">0</span>,i=<span class="number">0</span>;</span><br><span class="line"> <span class="keyword">while</span>(temp&lt;T&amp;&amp;i&lt;N)&#123;</span><br><span class="line"> ans++;</span><br><span class="line"> top=temp;</span><br><span class="line"> <span class="keyword">if</span>(n[i].s&gt;temp+<span class="number">1</span>)</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">while</span>(n[i].s&lt;=temp+<span class="number">1</span>&amp;&amp;i&lt;N)&#123;</span><br><span class="line"> top=max(n[i].e,top);</span><br><span class="line"> i++;</span><br><span class="line"> &#125;</span><br><span class="line"> temp=top;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span>(temp&lt;T)</span><br><span class="line"> <span class="built_in">cout</span>&lt;&lt;<span class="number">-1</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="built_in">cout</span>&lt;&lt;ans&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


</div>
Expand Down
2 changes: 1 addition & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ pre .javascript .function {
width: 4px;
height: 4px;
border-radius: 50%;
background: #fb2a03;
background: #1d7150;
}
.links-of-blogroll {
font-size: 13px;
Expand Down
Loading

0 comments on commit 41ffa81

Please sign in to comment.