题目链接 本质是维护斜率递增序列. 用分块的方法就是把序列分成sqrt(n)块,每个块分别用一个vector维护递增序列.查询的时候遍历所有的块,同时维护当前最大斜率,二分找到每个块中比当前最大斜率大的那个点.修改的时候只需要修改点所在的那个块即可.复杂度$O(m\sqrt nlogn)$ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; ; int n,m,h[N],in…
我原来准备做方差的.. 结果发现不会维护两个标记.. 就是操作变成一个 a*x+b ,每次维护a , b 即可 加的时候a=1 ,b=v 乘的时候a=v ,b=0 #include <cstdio> ; long long a[Maxn],n,P,l,r,c,m,type; struct Node { long long mul,add,sum,len; }tree[Maxn<<]; inline void Change(long long o,long long mul,long…
Sean owns a company and he is the BOSS.The other Staff has one Superior.every staff has a loyalty and ability.Some times Sean will fire one staff.Then one of the fired man’s Subordinates will replace him whose ability is higher than him and has the h…
E. DZY Loves Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they…