Skip to content

Commit

Permalink
update from gridea: 2020-02-28 17:14:16
Browse files Browse the repository at this point in the history
  • Loading branch information
hkr04 committed Feb 28, 2020
1 parent e5da24b commit f398f0d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 21 deletions.
4 changes: 2 additions & 2 deletions archives/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -18,7 +18,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down
2 changes: 1 addition & 1 deletion atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://hkr04.github.io</id>
<title>hkr04</title>
<updated>2020-02-28T09:11:48.010Z</updated>
<updated>2020-02-28T09:14:15.923Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<link rel="alternate" href="https://hkr04.github.io"/>
<link rel="self" href="https://hkr04.github.io/atom.xml"/>
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -18,7 +18,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down
39 changes: 31 additions & 8 deletions post/magic-balls-problem/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>魔术球问题 | hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="魔术球问题 | hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Serif:400,700">



<meta name="description" content="题目希望我们在nnn个柱子放上最多的球,并且要求相邻的球之间满足相加为完全平方数的条件。较显然的一点是,对于递增的nnn来说,其所能放的最多球的数量一定是单调上升的。因为新增加的柱子至少可以比前一个的最大方案多放一个。同时,如果编号为xxx..." />
<meta name="description" content="题意简述
题目希望我们在nnn个柱子放上最多的球,并且要求相邻的球之间满足相加为完全平方数的条件。
题解
较显然的一点是,对于递增的nnn来说,其所能放的最多球的数量一定是单调上升的。因为新增加的柱子至少可以比前一个的最大方案多放一个。同时..." />
<meta name="keywords" content="网络流,题解" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css">
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
Expand All @@ -21,7 +24,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down Expand Up @@ -96,11 +99,14 @@ <h2 class="post-title">

<div class="post-content-wrapper">
<div class="post-content">
<p>题目希望我们在<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">n</span></span></span></span>个柱子放上最多的球,并且要求相邻的球之间满足相加为完全平方数的条件。较显然的一点是,对于递增的<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">n</span></span></span></span>来说,其所能放的最多球的数量一定是单调上升的。因为新增加的柱子至少可以比前一个的最大方案多放一个。同时,如果编号为<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">x</span></span></span></span>的球已经找不到放下的方案,根据题目要求,大于<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">x</span></span></span></span>的球数也一定是不合法的。</p>
<p>再从另一个角度考虑,球数增加时所需要的最少柱子数量也是单调不增的。于是就可以将这题转化为<strong>求最大的球数,使得其最小覆盖恰不大于n</strong>。如果你还没有做过最小覆盖相关的题目,简单来说,就是你需要把一些元素分成互不相交的集合,且使得集合数最小。参考<a href="https://www.luogu.com.cn/blog/hkr04/the-smallest-path-cover">最小路径覆盖问题</a>,这两者的建模方式是类似的,在本题中每尝试增加一个球就让它尝试和之前的球连边即可。<br>
<h4 id="题意简述">题意简述</h4>
<p>题目希望我们在<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">n</span></span></span></span>个柱子放上最多的球,并且要求相邻的球之间满足相加为完全平方数的条件。</p>
<h4 id="题解">题解</h4>
<p>较显然的一点是,对于递增的<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">n</span></span></span></span>来说,其所能放的最多球的数量一定是单调上升的。因为新增加的柱子至少可以比前一个的最大方案多放一个。同时,如果编号为<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">x</span></span></span></span>的球已经找不到放下的方案,根据题目要求,大于<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">x</span></span></span></span>的球数也一定是不合法的。</p>
<p>再从另一个角度考虑,球数增加时所需要的最少柱子数量也是单调不增的。于是就可以将这题转化为<strong>求最大的球数,使得其最小覆盖恰不大于n</strong>。如果你还没有做过最小覆盖相关的题目,简单来说,就是你需要把一些元素分成互不相交的集合,且使得集合数最小。参考<a href="https://hkr04.github.io/post/the-smallest-path-cover/">最小路径覆盖问题</a>,这两者的建模方式是类似的,在本题中每尝试增加一个球就让它尝试和之前的球连边即可。<br>
这题就这么解决啦,关键的地方在于找出单调性和由最大转化为最小可行问题。</p>
<p>(关于球的枚举上界问题,可以先设一个较大的值再跑一下极限数据看看)<br>
代码:</p>
<p>(关于球的枚举上界问题,可以先设一个较大的值再跑一下极限数据看看)</p>
<h4 id="代码">代码</h4>
<pre><code class="language-cpp">#include &lt;cstdio&gt;
#include &lt;cstring&gt;
#include &lt;cmath&gt;
Expand Down Expand Up @@ -259,7 +265,24 @@ <h2 class="post-title">

</div>
<div class="toc-container">

<ul class="markdownIt-TOC">
<li>
<ul>
<li>
<ul>
<li>
<ul>
<li><a href="#%E9%A2%98%E6%84%8F%E7%AE%80%E8%BF%B0">题意简述</a></li>
<li><a href="#%E9%A2%98%E8%A7%A3">题解</a></li>
<li><a href="#%E4%BB%A3%E7%A0%81">代码</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

</div>
</div>
</article>
Expand Down
4 changes: 2 additions & 2 deletions post/the-smallest-path-cover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>最小路径覆盖问题 | hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="最小路径覆盖问题 | hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -24,7 +24,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down
4 changes: 2 additions & 2 deletions tag/AUx6Qb151/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>题解 | hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="题解 | hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -18,7 +18,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down
4 changes: 2 additions & 2 deletions tag/BHy59ue1j/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>网络流 | hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="网络流 | hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -18,7 +18,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down
4 changes: 2 additions & 2 deletions tags/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>hkr04</title>
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881091435">
<link rel="shortcut icon" href="https://hkr04.github.io/favicon.ico?v=1582881238664">
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.3.0/fonts/remixicon.css" rel="stylesheet">
<link rel="stylesheet" href="https://hkr04.github.io/styles/main.css">
<link rel="alternate" type="application/atom+xml" title="hkr04 - Atom Feed" href="https://hkr04.github.io/atom.xml">
Expand All @@ -18,7 +18,7 @@
<div class="main-content">
<div class="site-header">
<a href="https://hkr04.github.io">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881091435" alt="">
<img class="avatar" src="https://hkr04.github.io/images/avatar.png?v=1582881238664" alt="">
</a>
<h1 class="site-title">
hkr04
Expand Down

0 comments on commit f398f0d

Please sign in to comment.