### 代码

#include
#define ls (p<<1)
#define rs (p<<1|1)
#define len (r-l+1)
#define maxn 1000100
#define ll long long
#define mid ((l+r)>>1)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a>1)+(x&1),lp=lazy[p];
lazy[p]=0;lazy[ls]=lazy[rs]=lp;
chkmax(rmn[ls],lp);
chkmax(rmn[rs],lp);
sum[ls]=(ll)lp*lx;
sum[rs]=(ll)lp*(x-lx);
}
void Build(int l,int r,int p){
if (l==r){sum[p]=rmn[p]=l;return;}
Build(l,mid,ls),Build(mid+1,r,rs);
Pushup(p);
}
int find(int l,int r,int k,int p){
if (l==r) return l;
if (lazy[p]) Pushdown(p,len);
if (rmn[ls]>=k) return find(l,mid,k,ls);
else return find(mid+1,r,k,rs);
}
void Update(int l,int r,int L,int R,int k,int p){
if (l>R||r=L&&r<=R){
sum[p]=(ll)len*k;
lazy[p]=rmn[p]=k;
return;
}
if (lazy[p]) Pushdown(p,len);
Update(l,mid,L,R,k,ls);
Update(mid+1,r,L,R,k,rs);
Pushup(p);
}
ll Query(int l,int r,int L,int R,int p){
if (l>R||r=L&&r<=R) return sum[p];
if (lazy[p]) Pushdown(p,len);
return Query(l,mid,L,R,ls)+Query(mid+1,r,L,R,rs);
}
int main(){
scanf("%d%d",&n,&q);
Build(1,n,1);
for (register int i=1,l,r;i<=q;++i){
scanf("%d%d",&l,&r);
l^=lastans,r^=lastans;
int pos=find(1,n,r,1)-1;
if (pos
 
 Share 【LuoGu T46495】子异和 / 题解 原题地址 [https://www.luogu.org/problemnew/show/T46495] 题意简述 集合 $S$ 的子异和被定义为… 01 Dec 2018 【笔记】动态 DP 这个算法的名字好毒瘤的样子。。。Dynamically Dynamical Programming，动态 – 动态规划，简称 DDP。 我们先考虑简单的动态规划。有一个经典问题叫做树上最大权独立集。比如 没有上司的舞会… 27 Nov 2018 
 
 
 Zepto's © 2024 Data & privacy Contact → Published with Ghost • Theme Attila • System theme 
 $(document).ready(function () { var viewport =$(window); var post = $('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() {$('pre code').each(function(i, e) { // Code highlight hljs.highlightElement(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code =$(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100);$('.progress-bar').css('width', progress + '%'); (progress > 100) ? $('.progress-container').addClass('complete'):$('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); });