Well, I don't know what the hell is going on, the data I have measured can be over and ignored. Because there was no reason to make it first, and then where did it die? Grass... Come again later. Clearly water problem.
--------------------------------------------------------------------------------
#include <cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespacestd;#defineRep (i,n) for (int i=1;i<=n;i++)#defineCLR (x,c) memset (x,c,sizeof (x))intRead () {intx=0; CharC=GetChar (); while(!IsDigit (c)) {C=GetChar (); } while(IsDigit (c)) {x=x*Ten+c-'0'; C=GetChar (); } returnx;} ints,t,add[4000000],nmax[4000000]; voidInsertintOintLintR) { if(r>l) Nmax[o]=max (nmax[o*2],nmax[o*2+1]); Nmax[o]+=Add[o];} voidUpdateintOintLintR) { if(s<=l&&r<=t) {Add[o]+=1; } Else{ intm=l+ (r-l)/2; if(t<=m) Update (o*2, l,m); Else if(s>m) Update (o*2+1, m+1, R); Else{update (o*2, l,m); Update (o*2+1, m+1, R); }} insert (O,L,R); } intMain () {CLR (Nmax,0); CLR (Add,0); intn=read (); Rep (i,n) {s=read (), t=read (); Update (1,1,1000000); } printf ("%d\n", nmax[1]); return 0; }
--------------------------------------------------------------------------------
bzoj1651: Segment Tree + marking