Recently SLQ is speaking two points ... Feel Noip even two years (Intelligent quality inspector, borrow classroom) also really ...
Two points plus pre-order and, water over.
NOIRP: The topic does not say with long long ah, the question person you pit me = =
Person: (Blame me?) ) 10^9*10^6 you don't count?
1#include <iostream>2 using namespacestd;3 Const intn=1000005;4typedefLong LongLL;5 structask{6 intl,r,s;7 }xw[n];8 LL Qz[n];9 intN,m,rs[n];Ten BOOLCheckintDay ) { One inti; Amemset (QZ,0,sizeof(QZ)); - for(i=1; i<=day;i++){ -qz[xw[i].l]+=Xw[i].s; theqz[xw[i].r+1]-=Xw[i].s; - } - for(i=1; i<=n;i++){ -qz[i]+=qz[i-1]; + if(rs[i]<Qz[i]) - return false; + } A return true; at } - voidReadint&x) { -x=0; - CharC=GetChar (); - while(c<'0'|| C>'9') c=GetChar (); - while(c>='0'&&c<='9'){ inx=x*Ten+c- -; -C=GetChar (); to } + } - intMain () the { *Freopen ("classroom.in","R", stdin); $Freopen ("Classroom.out","W", stdout);Panax Notoginseng intI,lo,hi; - read (n), read (m); the for(i=1; i<=n;i++) read (rs[i]); + for(i=1; i<=m;i++) Read (XW[I].S), read (XW[I].L), read (XW[I].R); A if(check (n)) { thecout<<0; + return 0; - } $lo=1, hi=N; $ while(lo<hi) { - intMid= (Lo+hi) >>1; - if(check (mid)) theLo=mid+1; - ElseWuyiHi=mid; the } -cout<<-1<<endl<<Lo; Wu return 0; -}
NOIP2012TG Day2t2 borrowed the classroom two minutes