NOIP Computational geometry exercises before exams

Source: Internet
Author: User

Bzoj 1580

Calculate the time of each segment directly and then simulate

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <algorithm>5#include <queue>6#include <vector>7#include <cmath>8 #definePa pair<double,double>9 #defineMP Make_pairTen #definePB Push_back One #defineSe Second A #defineFi first -   - using namespacestd; the Const intmaxn=50100; - Const intinf=0x3f3f3f3f; - intN,r,x,y,vx,vy,p[maxn],q[maxn],vp[maxn],vq[maxn],ans; -Vector<pa>V; +InlineintSQR (intx) {returnx*x;} -InlineDoubleMax (DoubleXDoubleY) {returnX>y?x:y;} + intMain () A { at     //freopen ("c.in", "R", stdin); -scanf"%d%d%d%d%d%d",&n,&r,&x,&y,&vx,&Vy); -      for(intI=1; i<=n;i++) -     { -scanf"%d%d%d%d",&p[i],&q[i],&vp[i],&vq[i]); -p[i]-=x,q[i]-=y,vp[i]-=vx,vq[i]-=Vy; in     } -      for(intI=1; i<=n;i++) to         if(vp[i]==0&& vq[i]==0) +         { -             if(SQR (P[i]) +SQR (Q[i]) <=SQR (R)) theV.PB (MP (0, INF)); *}Else $         {Panax Notoginseng             Doubledis=-(P[i]*vp[i]+q[i]*vq[i])/sqrt ((SQR (vp[i]) +SQR (Vq[i] )); -             if(R*r>= (Double) SQR (P[i]) + (Double) SQR (Q[i])-dis*Dis) the             { +                 DoubleTmp=sqrt (R*R-SQR (P[i])-SQR (Q[i]) +dis*Dis); AV.PB (MP (Max (dis-tmp,0.0)/sqrt (SQR (Vp[i]) +SQR (Vq[i]), (dis+tmp)/sqrt (SQR (vp[i)) +SQR (Vq[i] ))); the             } +         } -           $ sort (V.begin (), V.end ()); $priority_queue<Double>T; -       -      for(intI=0; I<v.size (); i++) the     { -T.push (-v[i].se);Wuyi          while(! T.empty () &&-t.top () <v[i].fi) T.pop (); theans=Max (Ans,t.size ()); -     } Wuprintf"%d\n", Ans); -     return 0; About}
Bzoj 1580

NOIP Computational geometry exercises before exams

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.