cf749 d.leaving Auction

Source: Internet
Author: User

1#include <bits/stdc++.h>2 #defineLowbit (x) x& (-X)3 #defineLL Long Long4 #defineN 2000055 #defineM 10000056 #defineMoD 1000000007LL7 #defineINF 0X7FFFFFFFF8 using namespacestd;9InlineintRA ()Ten { One     intx=0, f=1;CharCh=GetChar (); A      while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; Ch=GetChar ();} -      while(ch>='0'&& ch<='9') {x=x*Ten+ch-'0'; Ch=GetChar ();} -     returnx*F; the } -vector<int>Man[n]; - intMx[n],person[n]; - BOOLcmpintAintb) + { -     returnmx[a]<Mx[b]; + } A intMain () at { -     intn=RA (); -      for(intI=1; i<=n; i++) -     { -         intA=ra (), b=RA (); - Man[a].push_back (b); inmx[a]=b; -person[i]=i; to     } +Sort (person+1, person+1+n,cmp); -     intq=RA (); the      while(q--) *     { $         Set<int>leave;Panax Notoginseng         intk=RA (); -          for(intI=1; i<=k; i++) the         { +             intt=RA (); A Leave.insert (t); the         } +         inttmp[2],num=0; -tmp[0]=tmp[1]=0; $          for(intJ=m; i>=1; i--) $         { -             if(Leave.count (Person[i]))Continue; -tmp[num++]=Person[i]; the             if(num==2) Break; -         }Wuyi         if(man[tmp[0]].size () = =0) the         { -cout<<"0 0"<<Endl; Wu             Continue; -         } About         if(num==2) $         { -             intIt=*lower_bound (man[tmp[0]].begin (), man[tmp[0]].end (), mx[tmp[1]]); -printf"%d%d\n", tmp[0],it); -         } A         Else if(num==1) +printf"%d%d\n", tmp[0],man[tmp[0]][0]); the     } -     return 0; $ } the //It was embarrassing. At first, I thought we could find the biggest one. 2333 the //Unexpectedly only than the second largest big can, is really mentally retarded.  the //The first time you find a vector, you can play with Lower_bound 2333

cf749 d.leaving Auction

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.