Zoj3379 master spark

Source: Internet
Author: User

(When 3 [____] When scanning the line, the parabolic equation is in the form of Y = A * x * X,

Obtain the value range of theta-delta ~ of the central axis of the parabolic curve for each vertex ~ Theta + delta,

Theta = atan2 (Y, x), Delta uses the equations to solve x * x + y * Y = z * z + (A * z) ^ 2, Tan (theta) = z/(A * z), so theta = atan2 (1, A * z)

Scan from-pi to Pi, and use the minimum heap for maintenance.

I have been calling this question for a long time, writing> into <, and writing double into int... = Catch chicken

#include<cstdio>#include<cmath>#include<cstring>#include<vector>#include<utility>#include<iostream>#include<algorithm>using namespace std;const int N=30010;const double TPI = 2*acos(-1);double x[N],y[N];vector<pair<double,double> > ang;int cnt;double heap[N];void heap_add(double a){    heap[++cnt]=a;    int u,ch=cnt;    double t=heap[cnt];    u = cnt>>1;    while(u&&heap[u]>t) {        heap[ch]=heap[u];        ch>>=1;        u=ch>>1;    }    heap[ch]=t;}void heap_pop(){    heap[1]=heap[cnt];    --cnt;    int u=1,chl,chr,ch;    double t=heap[1];    while(cnt) {        chl=u<<1;        chr=chl|1;        if(chr<=cnt&&heap[chl]

 

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.