U678359 题解(英文版)

· · 个人记录

*\color{black}{+}\color{red}{\infty}

Consider how to solve this problem when we only have single-point modification.We have the following conclusions.(this part is premise conclusion) :

Lets l_i=\max\limits_{j<i,a_j>a_i}(j),r_i=\min\limits_{j>i,a_j>a_i}(j) .

Enumerate (l,r) that (l,r) is domination point pair .Lets w\gets \argmax\limits_{i=l+1}^{r-1}(a_i) . It's easily to find that l=l_w,r=r_w .So let's be bolder.we have following conclusions:

The prove is easy , so we skip it.

Next, consider a type of dominance point pair.If we have a ordered pair (l,r) and a number i that i\in(l,r) , (\sum\limits_{i=l+1}^{r-1}a_i)<\min(a_l,a_r) .We can consider that fish named i can't eat fish named in [1,l] or [r,n] .

So we have some conclusions:

Lets S_i=\sum\limits_{1\le j<i,(j,i)\ is \ dominance \ pair}\{j\} , T_i=\sum\limits_{i<j\le n,(i,j)\ is \ dominance \ pair}\{j\} 。

Then consider the changes to S and T in a single operation.We have the following conclusions:

Consider how to find these elements.Lets b_i\gets a_i-a_{i-1},d_i=a_i-a_{i+1} .It is easy to observe that each operation modifies the b and d arrays by adding a number (possibly 0 or a negative number) to a interval.

Now we need to implement the function of refactoring S_i and T_i . We only consider refactoring Si.It is easy to find that we need to implement O (\log n) to find the maximum i that satisfies a_i>(\sum\limits_{j=i+1}^{x}a_j ) , Define s as the internal \sum a of the previous dominating point pair .Then we have following conclusions:

This condition is not very simple, we need to strengthen it, so we have following conclusions:

Note that a_i-a_{i+1}=d_i, and each modification has an impact on d in the form of adding or subtracting a number in the interval. Therefore, we can perform binary partitioning on the line segment tree, which can reconstruct S _i or T_i by O(n\log V\log n) .

Therefore, we only need to find the appearance and departure time of each dominant point pair now, and consider dynamic maintenance.

So we can categorize and discuss the impact of interval modification on the dominance point pair [l,r] , assuming that the modified interval is [L',R'] .

The situation of L'\le l is still the same, but there is a special case:

Then implement a scanning line method to achieve AC.

Therefore, we solved this problem within the complexity of O (n \log n \log V) .

We just wrote the solution for U646757,Let's start the abnormal mode below.

For parallel universes in the m dimension, we have the following conclusion:

Since eating fish requires strict partial order in all dimensions, assuming there is a (s_1,\cdots,s_m) fish, we consider finding the first >s_i fish for each dimension. We define the property of a fish as S \gets \prod \limits_ {1\le i\le m}(s_i), so S will not exceed V ^ m .

证明:根据 Observation 12 推得。

接下来考虑多项式的问题,我们定义 f(x)\gets \max\limits_{i^x\ge (\sum\limits_{j=1}^{i-1} j^x)}(i)+1

证明:考虑因式分解, a^m-b^m=(a-b)(\sum\limits_{i=0}^{m-1} a^ib^{m-1-i}) ,右边显然是递增的。

证明:

定义 S_n=\sum\limits_{i=1}^{n-1}\{\frac{i}{n}\} ,那么显然当 S_n 排序小于 S_{n+1} 的时候结论成立,那么显然 S_n<S_{n+1} ,证毕。

证明:由 Observation 16 推得。

证明:考虑放缩,关于平均数对称 ,(\sum\limits_{i=1}^{2^x+1}i^x)\ge(2^{x-1}+1)^x(2^x+1)=(2^x+2)^x+(2^{x-1}+1)^x 。

证明:因为每次加上一个大于其本身的数 \log_2(sum) 都会至少 +1 ,因此可以列不等式: m\log x\le x ,解得 x 在 O(m\log m) 的量级内。

接下来就是原来的算法了,注意到重点依然在寻找支配点对上,定义 c_{i,j}\gets \max(c_{i,j-1},0)-\max(c_{i-j,j-1},0) , c_{i,0}\gets a_i 。

那么我们有结论:

以下是强制在线且 k\ge 2 的情况,k=1 直接用 Observation 20 即可。

定义 d_{i,j}\gets d_{i,j-1}-d_{i-2^{j-1},j-1} , d_{i,0}\gets a_i 。

那么我们有结论:

证明考虑归纳,略。

证明略。

那么注意到每次查找第一个 d_{i,k}>s 的 i 后 s 会变为 (1+\frac{1}{2^k})s+\delta(\delta\ge 0) 。

证明考虑随便差分一下就好了。

那么整体的复杂度就是 O(nm^24^kk^2\log k\log n\log V) ,做完了,暴力算法的复杂度是 O(nq(k+m\log V)) 。