洛谷暂无评定题目新鲜出炉,本题解非洛谷题解
让我们看一看题
题目描述
We call any sequence of points in the plane a plot.
We intend to replace a given plot (P_1,\cdots,P_n)(P1,⋯,Pn) with another that will have at most mm points (m\le nm≤n) in such a way that it "resembles" the original plot best.
The new plot is created as follows. The sequence of points P_1,\cdots,P_nP1,⋯,Pn can be partitioned into ss (s\le ms≤m) contiguous subsequences:
(P_{k_0+1},\cdots,P_{k_1}),(P_{k_1+1},\cdots,P_{k_2}),\cdots,(P_{k_{s-1}+1},\cdots,P_{k_s})(Pk0+1,⋯,Pk1),(Pk1+1,⋯,Pk2),⋯,(Pks−1+1,⋯,Pks) where 0=k_0<k_1<k_2<\cdots<k_s=n0=k0<k1<k2<⋯<ks=n,and afterwards each subsequence (P_{k_{i-1}+1},\cdots,P_{k_i})(Pki−1+1,⋯,Pki), for i=1,\cdots,si=1,⋯,s,is replaced by a new point Q_iQi.
In that case we say that each of the points P_{k_{i-1}+1},\cdots,P_{k_i}Pki−1+1,⋯,Pki has been contracted to the point Q_iQi.
As a result a new plot, represented by the points Q_1,\cdots,Q_sQ1,⋯,Qs, is created.
The measure of such plot's resemblance to the original is the maximum distance of all the points P_1,\cdots,P_nP1,⋯,Pn to the point it has been contracted to:
max_{i=1,\cdots,s}(max_{j=k_{i-1}+1,\cdots,k_i}(d(P_j,Q_i)))maxi=1,⋯,s(maxj=ki−1+1,⋯,ki(d(Pj,Qi))) where d(P_j,Q_i)d(Pj,Qi) denotes the distance between P_jPj and Q_iQi, given by the well-known formula:
d((x_1,y_1),(x_2,y_2))=\sqrt{(x_2-x_1)^2&#