NOIP2012TG Day2t2 borrowed the classroom two minutes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.