<div class="problems-statistical" data-v-c91880aa="">
<div class="problems-status" data-v-c91880aa="">
<div class="title" data-v-c91880aa="">
dijkstra
</div>
<p data-v-c91880aa=""><button class="purple" data-v-c91880aa="">已经提交</button> <button class="purple" data-v-c91880aa="">已经通过</button></p>
</div>
<div class="round" data-v-c91880aa="">
<span data-v-c91880aa="">42.86%</span>
</div>
<div class="data" data-v-c91880aa="">
<p data-v-c91880aa="">Total Submission:<span data-v-c91880aa="">189</span></p>
<p data-v-c91880aa="">Total Accepted:<span data-v-c91880aa="">81</span></p>
</div>
</div>
<div class="problems-header markdown-body" data-v-c91880aa="">
<p class="title" data-v-c91880aa="">题目描述</p>
<p class="content" data-v-c91880aa=""> </p>
<p>Eagle Jump公司正在开发一款新的游戏。泷本一二三作为其员工,获得了提前试玩的机会。现在她正在试图通过一个迷宫。</p>
<p>这个迷宫有一些特点。为了方便描述,我们对这个迷宫建立平面直角坐标系。迷宫中有两条平行直线 <span class="katex"><span class="katex-mathml">L_1:Ax+By+C_1=0<span class="katex-html"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">L<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">:<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">A<span class="mord mathdefault">x<span class="mspace"><span class="mbin">+<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">B<span class="mord mathdefault">y<span class="mspace"><span class="mbin">+<span class="mspace"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">=<span class="mspace"><span class="base"><span class="strut"><span class="mord">0, <span class="katex"><span class="katex-mathml">L_2:Ax+By+C_2=0<span class="katex-html"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">L<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">:<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">A<span class="mord mathdefault">x<span class="mspace"><span class="mbin">+<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">B<span class="mord mathdefault">y<span class="mspace"><span class="mbin">+<span class="mspace"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">=<span class="mspace"><span class="base"><span class="strut"><span class="mord">0,还有 <span class="katex"><span class="katex-mathml">n<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">n 个圆 <span class="katex"><span class="katex-mathml">C_i:(x-x_i)^2+(y-y_i)^2={r_i}^2<span class="katex-html"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">i<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">:<span class="mspace"><span class="base"><span class="strut"><span class="mopen">(<span class="mord mathdefault">x<span class="mspace"><span class="mbin">−<span class="mspace"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">x<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">i<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mclose"><span class="mclose">)<span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="mspace"><span class="mbin">+<span class="mspace"><span class="base"><span class="strut"><span class="mopen">(<span class="mord mathdefault">y<span class="mspace"><span class="mbin">−<span class="mspace"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">y<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">i<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mclose"><span class="mclose">)<span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="mspace"><span class="mrel">=<span class="mspace"><span class="base"><span class="strut"><span class="mord"><span class="mord"><span class="mord"><span class="mord mathdefault">r<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">i<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2。角色在直线上、圆上、圆内行走不消耗体力。在其他位置上由<span class="katex"><span class="katex-mathml">S<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">S点走到<span class="katex"><span class="katex-mathml">T<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">T点消耗的体力为<span class="katex"><span class="katex-mathml">S<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">S和<span class="katex"><span class="katex-mathml">T<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">T的欧几里得距离。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p>泷本一二三想从 <span class="katex"><span class="katex-mathml">L_1<span class="katex-html"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">L<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span> 出发,走到 <span class="katex"><span class="katex-mathml">L_2<span class="katex-html"><span class="base"><span class="strut"><span class="mord"><span class="mord mathdefault">L<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span> 。请计算最少需要多少体力。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p> </p>
</div>
<div class="problems-header ivu-card ivu-card-dis-hover ivu-card-shadow" data-v-c91880aa="">
<div class="ivu-card-head">
</div>
<div class="ivu-card-extra">
</div>
<div class="ivu-card-body">
<div class="panel-body">
<div id="problem-content" class="markdown-body" data-v-c91880aa="">
<p class="title" data-v-c91880aa="">输入描述</p>
<p class="content" data-v-c91880aa=""> </p>
<p>第一行五个正整数 <span class="katex"><span class="katex-mathml">n,A,B,C_1,C_2<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">n<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">A<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">B<span class="mpunct">,<span class="mspace"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mpunct">,<span class="mspace"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span> <span class="katex"><span class="katex-mathml">(1\le n \le 1000, -10000 \le A,B,C_1,C_2 \le 10000)<span class="katex-html"><span class="base"><span class="strut"><span class="mopen">(<span class="mord">1<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">n<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mpunct">,<span class="mspace"><span class="mord">−<span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mord">0<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">A<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">B<span class="mpunct">,<span class="mspace"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mpunct">,<span class="mspace"><span class="mord"><span class="mord mathdefault">C<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2<span class="vlist-s"><span class="vlist-r"><span class="vlist"><span><span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mord">0<span class="mclose">),其中 <span class="katex"><span class="katex-mathml">A,B<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">A<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">B 不同时为 0。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p>接下来 <span class="katex"><span class="katex-mathml">n<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">n 行每行三个整数 <span class="katex"><span class="katex-mathml">x,y,r(-10000 \le x,y \le 10000, 1\le r \le 10000)<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">x<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">y<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">r<span class="mopen">(<span class="mord">−<span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mord">0<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">x<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">y<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mord">0<span class="mpunct">,<span class="mspace"><span class="mord">1<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord mathdefault">r<span class="mspace"><span class="mrel">≤<span class="mspace"><span class="base"><span class="strut"><span class="mord">1<span class="mord">0<span class="mord">0<span class="mord">0<span class="mord">0<span class="mclose">) 表示一个圆心为 <span class="katex"><span class="katex-mathml">(x,y)<span class="katex-html"><span class="base"><span class="strut"><span class="mopen">(<span class="mord mathdefault">x<span class="mpunct">,<span class="mspace"><span class="mord mathdefault">y<span class="mclose">),半径为 <span class="katex"><span class="katex-mathml">r<span class="katex-html"><span class="base"><span class="strut"><span class="mord mathdefault">r 的圆。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p> </p>
<p class="title" data-v-c91880aa="">输出描述</p>
<p class="content" data-v-c91880aa=""> </p>
<p>仅一行一个实数表示答案。与标准答案的绝对误差或者相对误差不超过 <span class="katex"><span class="katex-mathml">10^{-4}<span class="katex-html"><span class="base"><span class="strut"><span class="mord">1<span class="mord"><span class="mord">0<span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">−<span class="mord mtight">4 即算正确。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p> </p>
<div data-v-c91880aa="">
<div class="flex-container sample" data-v-c91880aa="">
<div class="sample-input" data-v-c91880aa="">
<p class="title" data-v-c91880aa="">样例输入 1 </p>
<pre data-v-c91880aa="">2 0 1 0 -4
0 1 1
1 3 1</pre>
</div>
<div class="sample-output" data-v-c91880aa="">
<p class="title" data-v-c91880aa="">样例输出 1</p>
<pre data-v-c91880aa="">0.236068<br><br><span style="font-size: 18px;">题意:给定两个平行的直线,直线中间有若干个圆,点在直线和圆上行走不消耗能力。问从第一条直线走到第二条直线最小需要消耗多少能量。<br></span><span style="font-size: 18px;">距离即代表消耗的能力。<br>思路:<br>1、首先处理每一个圆心到其他圆心和直线的距离,以各个圆心点和直线缩成点构成一个图,然后根据距离跑最短路算法即可。<br>2、注意距离减去半径的时候如果是负数要赋值为0。<br>细节见我的代码;<br></span></pre>
<div class="cnblogs_code">
<pre>#include <iostream><span style="color: #000000;">
#include </span><cstdio><span style="color: #000000;">
#include </span><cstring><span style="color: #000000;">
#include </span><algorithm><span style="color: #000000;">
#include </span><cmath><span style="color: #000000;">
#include </span><queue><span style="color: #000000;">
#include </span><map><span style="color: #000000;">
#include </span><<span style="color: #0000ff;">set</span>><span style="color: #000000;">
#include </span><vector>
<span style="color: #0000ff;">#define</span> rep(i,x,n) for(int i=x;i<n;i++)
<span style="color: #0000ff;">#define</span> repd(i,x,n) for(int i=x;i<=n;i++)
<span style="color: #0000ff;">#define</span> pii pair<int,int>
<span style="color: #0000ff;">#define</span> pll pair<long long ,long long>
<span style="color: #0000ff;">#define</span> gbtb std::ios::sync_with_stdio(false)
<span style="color: #0000ff;">#define</span> MS0(X) memset((X), 0, sizeof((X)))
<span style="color: #0000ff;">#define</span> MSC0(X) memset((X), '\0', sizeof((X)))
<span style="color: #0000ff;">#define</span> pb push_back
<span style="color: #0000ff;">#define</span> mp make_pair
<span style="color: #0000ff;">#define</span> fi first
<span style="color: #0000ff;">#define</span> se second
<span style="color: #0000ff;">#define</span> gg(x) getInt(&x)
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;
typedef </span><span style="color: #0000ff;">long</span> <span style="color: #0000ff;">long</span><span style="color: #000000;"> ll;
inline </span><span style="color: #0000ff;">void</span> getInt(<span style="color: #0000ff;">int</span>*<span style="color: #000000;"> p);
</span><span style="color: #008000;">/*</span><span style="color: #008000;">** TEMPLATE CODE STARTS HERE **</span><span style="color: #008000;">*/</span>
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> maxn=<span style="color: #800080;">10008</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> INF= <span style="color: #800080;">0x3f3f3f3f</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> Node
{
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> to;
</span><span style="color: #0000ff;">double</span><span style="color: #000000;"> dist;
Node(){}
Node(</span><span style="color: #0000ff;">int</span> _n,<span style="color: #0000ff;">double</span><span style="color: #000000;"> _d)
{
to</span>=<span style="color: #000000;">_n;
dist</span>=<span style="color: #000000;">_d;
}
</span><span style="color: #0000ff;">bool</span> <span style="color: #0000ff;">operator</span> < (<span style="color: #0000ff;">const</span> Node x ) <span style="color: #0000ff;">const</span><span style="color: #000000;">
{
</span><span style="color: #0000ff;">return</span> dist ><span style="color: #000000;"> x.dist;
}
};
priority_queue</span><Node><span style="color: #000000;"> heap;
vector </span><Node><span style="color: #000000;"> Map[maxn];
</span><span style="color: #0000ff;">double</span><span style="color: #000000;"> dis[maxn];
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> t,n,star;
</span><span style="color: #0000ff;">void</span> dijkstra (<span style="color: #0000ff;">int</span><span style="color: #000000;"> strat)
{
</span><span style="color: #008000;">//</span><span style="color: #008000;"> memset(dis,INF,sizeof(dis));</span>
repd(i,<span style="color: #800080;">1</span>,maxn-<span style="color: #800080;">1</span><span style="color: #000000;">)
{
dis[i]</span>=<span style="color: #800080;">9999999999.0</span><span style="color: #000000;">;
}
dis[strat]</span>=<span style="color: #800080;">0</span><span style="color: #000000;">;
heap.push(Node(strat,dis[strat]));
</span><span style="color: #0000ff;">while</span>(!<span style="color: #000000;">heap.empty())
{
Node x</span>=<span style="color: #000000;"> heap.top();
heap.pop();
</span><span style="color: #0000ff;">int</span> LEN=<span style="color: #000000;">Map[x.to].size();
rep(i,</span><span style="color: #800080;">0</span><span style="color: #000000;">,LEN)
{
Node now </span>=<span style="color: #000000;">Map[x.to][i];
</span><span style="color: #0000ff;">if</span>(dis[now.to]>x.dist+<span style="color: #000000;">now.dist)
{
dis[now.to]</span>=x.dist+<span style="color: #000000;">now.dist;
heap.push(Node(now.to,dis[now.to]));
}
}
}
}
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> a,b,c1,c2;
</span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> yuan
{
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> x,r,y;
}y[maxn];
</span><span style="color: #0000ff;">double</span> getdis(<span style="color: #0000ff;">int</span><span style="color: #000000;"> id)
{
</span><span style="color: #0000ff;">double</span> res=<span style="color: #800080;">0.00000</span><span style="color: #000000;">;
res</span>=max(<span style="color: #800080;">0.000</span>,fabs(a*y[id].x+b*y[id].y+c1)*<span style="color: #800080;">1.000</span>/sqrt(a*a+b*<span style="color: #000000;">b));
</span><span style="color: #0000ff;">return</span><span style="color: #000000;"> res;
}
</span><span style="color: #0000ff;">double</span> getdis2(<span style="color: #0000ff;">int</span><span style="color: #000000;"> id)
{
</span><span style="color: #0000ff;">double</span> res=<span style="color: #800080;">0.00000</span><span style="color: #000000;">;
res</span>=max(<span style="color: #800080;">0.00</span>,fabs(a*y[id].x+b*y[id].y+c2)*<span style="color: #800080;">1.000</span>/sqrt(a*a+b*<span style="color: #000000;">b));
</span><span style="color: #0000ff;">return</span><span style="color: #000000;"> res;
}
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()
{
</span><span style="color: #008000;">//</span><span style="color: #008000;"> scanf("%d %d %d",&n,&t,&star);
</span><span style="color: #008000;">//</span><span style="color: #008000;"> int a,b,d;
</span><span style="color: #008000;">//</span><span style="color: #008000;"> repd(i,1,t)
</span><span style="color: #008000;">//</span><span style="color: #008000;"> {
</span><span style="color: #008000;">//</span><span style="color: #008000;"> scanf("%d %d %d",&a,&b,&d);
</span><span style="color: #008000;">//</span><span style="color: #008000;"> Map[a].pb(Node(b,d));
</span><span style="color: #008000;">//</span> <span style="color: #008000;">//</span><span style="color: #008000;"> Map[b].pb(Node(a,d));
</span><span style="color: #008000;">//</span><span style="color: #008000;"> }
</span><span style="color: #008000;">//</span><span style="color: #008000;"> dijkstra(star);
</span><span style="color: #008000;">//</span><span style="color: #008000;"> printf("%d\n",ans);</span>
<span style="color: #000000;"> gg(n);
gg(a);gg(b);gg(c1);gg(c2);
repd(i,</span><span style="color: #800080;">3</span>,n+<span style="color: #800080;">2</span><span style="color: #000000;">)
{
gg(y[i].x);
gg(y[i].y);
gg(y[i].r);
}
repd(i,</span><span style="color: #800080;">3</span>,n+<span style="color: #800080;">2</span><span style="color: #000000;">)
{
</span><span style="color: #0000ff;">double</span> dt=max(getdis(i)-y[i].r,<span style="color: #800080;">0.00</span><span style="color: #000000;">);
Map[</span><span style="color: #800080;">1</span><span style="color: #000000;">].push_back(Node(i,dt));
Map[i].push_back(Node(</span><span style="color: #800080;">1</span><span style="color: #000000;">,dt));
}
repd(i,</span><span style="color: #800080;">3</span>,n+<span style="color: #800080;">2</span><span style="color: #000000;">)
{
</span><span style="color: #0000ff;">double</span> dt=max(getdis2(i)-y[i].r,<span style="color: #800080;">0.00</span><span style="color: #000000;">);
Map[</span><span style="color: #800080;">2</span><span style="color: #000000;">].push_back(Node(i,dt));
Map[i].push_back(Node(</span><span style="color: #800080;">2</span><span style="color: #000000;">,dt));
}
repd(i,</span><span style="color: #800080;">3</span>,n+<span style="color: #800080;">2</span><span style="color: #000000;">)
{
repd(j,</span><span style="color: #800080;">3</span>,n+<span style="color: #800080;">2</span><span style="color: #000000;">)
{
</span><span style="color: #0000ff;">if</span>(i==<span style="color: #000000;">j)
{
</span><span style="color: #0000ff;">continue</span><span style="color: #000000;">;
}</span><span style="color: #0000ff;">else</span><span style="color: #000000;">
{
</span><span style="color: #0000ff;">double</span> dt=max(<span style="color: #800080;">0.000</span>,-y[i].r-y[j].r+sqrt((y[i].x-y[j].x)*(y[i].x-y[j].x)+(y[i].y-y[j].y)*(y[i].y-<span style="color: #000000;">y[j].y)));
Map[i].push_back(Node(j,dt));
Map[j].push_back(Node(i,dt));
}
}
}
dijkstra(</span><span style="color: #800080;">1</span><span style="color: #000000;">);
printf(</span><span style="color: #800000;">"</span><span style="color: #800000;">%.6lf\n</span><span style="color: #800000;">"</span>,dis[<span style="color: #800080;">2</span><span style="color: #000000;">] );
</span><span style="color: #0000ff;">return</span> <span style="color: #800080;">0</span><span style="color: #000000;">;
}
inline </span><span style="color: #0000ff;">void</span> getInt(<span style="color: #0000ff;">int</span>*<span style="color: #000000;"> p) {
</span><span style="color: #0000ff;">char</span><span style="color: #000000;"> ch;
</span><span style="color: #0000ff;">do</span><span style="color: #000000;"> {
ch </span>=<span style="color: #000000;"> getchar();
} </span><span style="color: #0000ff;">while</span> (ch == <span style="color: #800000;">'</span> <span style="color: #800000;">'</span> || ch == <span style="color: #800000;">'</span><span style="color: #800000;">\n</span><span style="color: #800000;">'</span><span style="color: #000000;">);
</span><span style="color: #0000ff;">if</span> (ch == <span style="color: #800000;">'</span><span style="color: #800000;">-</span><span style="color: #800000;">'</span><span style="color: #000000;">) {
</span>*p = -(getchar() - <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span><span style="color: #000000;">);
</span><span style="color: #0000ff;">while</span> ((ch = getchar()) >= <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span> && ch <= <span style="color: #800000;">'</span><span style="color: #800000;">9</span><span style="color: #800000;">'</span><span style="color: #000000;">) {
</span>*p = *p * <span style="color: #800080;">10</span> - ch + <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span><span style="color: #000000;">;
}
}
</span><span style="color: #0000ff;">else</span><span style="color: #000000;"> {
</span>*p = ch - <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">while</span> ((ch = getchar()) >= <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span> && ch <= <span style="color: #800000;">'</span><span style="color: #800000;">9</span><span style="color: #800000;">'</span><span style="color: #000000;">) {
</span>*p = *p * <span style="color: #800080;">10</span> + ch - <span style="color: #800000;">'</span><span style="color: #800000;">0</span><span style="color: #800000;">'</span><span style="color: #000000;">;
}
}
}</span></pre>
</div>
<p> </p>
<pre data-v-c91880aa=""></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p>
<audio controls="controls" style="display: none;"></audio></p>