priority_queue> q; ll bs[1d5]; ll ad,as[1d5+1]; int lc[1d5],rc[1d5]; { int @n,@m; rd(bs(n)); rep(m){ ll @l,@r; q.push({-(l-1),-(r)}); } rep(i,0,n,2)bs[i]=-bs[i]; int x=0; while(!q.empty()){ pair p=q.top(); q.pop(); ll l=-p.first; ll r=-p.second; while(x p2=q.top(); q.pop(); q.push({r,-p2.second}); } ad+=as[x]; as[r]-=bs[x]-ad; ad=bs[x]; ++x; } { while(x