摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1754 基础线段树,单点替换,区间最值。code:#include<cstdio>#include<algorithm>usingnamespacestd;#definelsonl,m,rt<<1#definersonm+1,r,rt<<1|1constintmaxn=200010;intsum[maxn<<2];template<classT>inlinevoidscan_d(T&ret){charc;ret=0;while(( 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1166 最基础的线段树,单点更新。完全跟着HH的代码风格写的。code:#include<cstdio>#definelsonl,m,rt<<1#definersonm+1,r,rt<<1|1constintmaxn=50005;intsum[maxn<<2];voidPushUp(intrt){sum[rt]=sum[rt<<1]+sum[rt<<1|1];}voidbuild(intl,intr,intrt){if(l==r){sca 阅读全文