跳到正文

题解

P3218[HNOI2011]赛车游戏

渔歌约 5 分钟
原文
文章信息与版本

文章信息

收录
2026年6月11日
更新
2026年6月13日
篇幅
约 5 分钟
获赞
3
题目
P3218

版本

  1. v1当前

[HNOI2011] 赛车游戏

对取平均数的简单证明

  • (可能是伪证,发现错误希望能指出,毕竟据说是拉格朗日乘数法)
  • 我们把每一段需要耗油的拎出来合在一起,在没有最大速度 vmax 的限制下,显然油耗完最优,那我们就能得到这样的式子(斜率为k):
∑j=1mv[j]∗s′[j]=(f−∑i=1nb∗k[i]∗s[i])/a∑j=1ms′[j]=∑i=1ns[i]\sum_{j=1}^m v[j]*s'[j]=(f-\sum_{i=1}^n b*k[i]*s[i])/a\\ \sum_{j=1}^m s'[j]=\sum_{i=1}^n s[i]
  • 之所以左侧用的是 m 是因为每一段上升或平地也可以拆成几段赋予不同的速度。
  • 右侧均看成一个定值,所以问题转换成了下式(v[j]→xi,s′[j]→yi,n→mv[j]\to x_i,s'[j] \to y_i,n \to m):
∑i=1nxiyi=f∑i=1nyi=s求min⁡(∑i=1nyixi)xi>0,yi>0,f,s为定量 \begin{aligned}\sum_{i=1}^n x_iy_i=f\\\sum_{i=1}^n y_i=s\\求 \min{(\sum_{i=1}^n \frac {y_i}{x_i})}\\x_i>0,y_i>0,f,s为定量\end{aligned}

【壹】按速度分成两段:

x1y1+x2y2=fy1+y2=s求min⁡(y1x1+y2x2)x1,x2>0,y1,y2>0,f,s为定量\begin{aligned} x_1y_1+x_2y_2=f\\ y_1+y_2=s\\ 求 \min{(\frac {y_1}{x_1}+\frac {y_2}{x_2})}\\ x_1,x_2>0,y_1,y_2>0,f,s为定量 \end{aligned}

一,我们分别考虑 y1y_1 取 len(0<len<s2)len(0<len<\frac{s}{2}) 的情况:

  • 有 y2=s−leny2=s-len, 带回一式。
x1len+x2(s−len)=fx2=f−x1lens−len\begin{aligned} x_1len+x_2(s-len) & =f\\ x_2=&\frac{f-x_1len}{s-len}\\ \end{aligned}
  • 由于要使 x2>0x_2>0 ,所以 f−x1len>0,flen>x1f-x_1len>0,\frac{f}{len}>x_1
y1x1+y2x2=y1x2+x1y2x1x2=f−x1lens−lenlen+(s−len)x1f−x1lens−lenx1=(f−x1len)len+(s−len)2x1(f−x1len)x1=flen+((s−len)2−len2)x1fx1−lenx12=flen+(s−2∗len)sx1fx1−lenx12\begin{aligned} \frac {y_1}{x_1}+\frac {y_2}{x_2}&=\frac {y_1x_2+x_1y_2}{x_1x_2}\\ &=\frac {\frac{f-x_1len}{s-len}len+(s-len)x_1}{\frac{f-x_1len}{s-len}x_1}\\ &=\frac {(f-x_1len)len+(s-len)^2x_1}{{(f-x_1len)x_1}}\\ &=\frac {flen+((s-len)^2-len^2)x_1}{fx_1-lenx_1^2}\\ &=\frac {flen+(s-2*len)sx_1}{fx_1-lenx_1^2}\\ \end{aligned}
  • 求其最小值,就是求 fx1−lenx12flen+(s−2∗len)sx1\frac {fx_1-lenx_1^2}{flen+(s-2*len)sx_1} 的最大值
设x=flen+(s−2∗len)sx1,flen+(s−2∗len)fslen>x>lenf则x1=x−flen(s−2∗len)s\begin{aligned} &设x=flen+(s-2*len)sx_1,\frac {flen+(s-2*len)fs}{len}>x>lenf\\ &则x_1=\frac {x-flen}{(s-2*len)s}\\ \end{aligned} 原式=(x−lenf)f(s−2∗len)s−(x−flen(s−2∗len)s)2lenx=(x−lenf)(s−2∗len)fs−(x−lenf)2len(s−2∗len)2s2x=1(s−2∗len)2s2(s−2∗len)fsx−(s−2∗len)f2slen−lenx2−f2len3+2∗flen2xx=1(s−2∗len)2s2∗(fs2−2∗fslen+2∗flen2−lenx−f2s2len−2f2slen2+f2len3x)=1(s−2∗len)2s2∗(fs2−2∗fslen+2∗flen2−lenx−f2len(s−len)2x)\begin{aligned} 原式&=\frac{\frac {(x-lenf)f}{(s-2*len)s}-(\frac {x-flen}{(s-2*len)s})^2len}{x}\\ &=\frac{(x-lenf)(s-2*len)fs-(x-lenf)^2len}{(s-2*len)^2s^2x}\\ &=\frac{1}{(s-2*len)^2s^2}\frac{(s-2*len)fsx-(s-2*len)f^2slen-lenx^2-f^2len^3+2*flen^2x}{x}\\ &=\frac{1}{(s-2*len)^2s^2}*(fs^2-2*fslen+2*flen^2-lenx-\frac {f^2s^2len-2f^2slen^2+f^2len^3}{x})\\ &=\frac{1}{(s-2*len)^2s^2}*(fs^2-2*fslen+2*flen^2-lenx-f^2len\frac {(s-len)^2}{x}) \end{aligned}
  • 显然 (s−len)2(s-len)^2 为正,同时形似一个耐克函数,当x=f(s−len)x=f(s-len) 时有最小值(x>flenx>flen)。代入求得:x1=(s−2∗len)f(s−2∗len)s=fs,x2=f−fs∗lens−len=fsx_1=\frac{(s-2*len)f}{(s-2*len)s}=\frac{f}{s},x_2=\frac {f-\frac{f}{s}*len}{s-len}=\frac{f}{s}
  • x1=x2x_1=x_2,速度相同时答案一定有最小值 ff 。

二,对于y1=len=s2y_1=len=\frac{s}{2} 的情况:

(x1+x2)len=fx1+x2=flenlenx1+lenx2=(x1+x2)lenx1∗x2=len2x1∗x2(x_1+x_2)len=f\\ x_1+x_2=\frac{f}{len}\\ {\frac{len}{x_1}+\frac{len}{x_2}}=\frac{(x_1+x_2)len}{x_1*x_2}=\frac{len^2}{x_1*x_2}
  • 由均值不等式显然可得,x1=x2=f2∗len=fsx_1=x_2=\frac{f}{2*len}=\frac{f}{s} 时,答案有最小值 ff 。

三,对于y1=len>s2y_1=len>\frac{s}{2} 的情况:

  • 有s−len<s2s-len<\frac{s}{2},同理可得。

结论:

  • 在分成两段时,取平均速度最优,而我们按相同速度进行分段,则一段必定优于两段。

【贰】对于多段:

  • 以三段为例,由于三段可以拆成两段+一段,分成一段优于分成两段,故三段劣于两段劣于一段。
  • 数学归纳法,得证分为一段(取平均速度)最优。

【叁】后言:

  • 考试的时候肯定没有时间让你折腾这么多,根据感性理解由于求和的各项形式一致可以直接猜是平均数。

  • 感谢@ zhr2005的帮助,分类讨论 y1y_1 的状态是我一直没想出来的,也因此卡了半天多。可以说是他的想法成就了这篇题解。

原文
存档评论3 条抓取于