QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#644185#784. 旋转卡壳Zhou_JK97 138ms11276kbC++2328.2kb2024-10-16 11:36:302024-10-16 12:23:13

Judging History

你现在查看的是最新测评结果

  • [2024-10-16 12:23:13]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:97
  • 用时:138ms
  • 内存:11276kb
  • [2024-10-16 12:18:36]
  • hack成功,自动添加数据
  • (/hack/1005)
  • [2024-10-16 11:36:31]
  • 评测
  • 测评结果:100
  • 用时:139ms
  • 内存:11272kb
  • [2024-10-16 11:36:30]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cassert>
#include<chrono>
#include<random>
#include<vector>
#include<functional>
#include<iomanip>
#include<algorithm>
using namespace std;
namespace Geometry
{
    const double eps=1e-12;
    const double PI=acos(-1);
    const double INF=1e18;
    bool equal(double a,double b)
    {
        return abs(a-b)<eps;
    }
    bool less(double a,double b)
    {
        return b-a>=eps;
    }
    bool greater(double a,double b)
    {
        return a-b>=eps;
    }
    bool less_equal(double a,double b)
    {
        return b-a>-eps;
    }
    bool greater_equal(double a,double b)
    {
        return a-b>-eps;
    }
    class Point
    {
    public:
        double x,y;
        Point(){x=0,y=0;}
        Point(const double &_x,const double &_y):x(_x),y(_y) {}
        friend Point operator * (const Point &a,const double &b)
        {
            return Point(a.x*b,a.y*b);
        }
        friend Point operator * (const double &a,const Point &b)
        {
            return Point(a*b.x,a*b.y);
        }
        friend Point operator / (const Point &a,const double &b)
        {
            return Point(a.x/b,a.y/b);
        }
        friend Point operator + (const Point &a,const Point &b)
        {
            return Point(a.x+b.x,a.y+b.y);
        }
        Point operator += (const Point &b)
        {
            x+=b.x,y+=b.y;
            return *this;
        }
        friend Point operator - (const Point &a,const Point &b)
        {
            return Point(a.x-b.x,a.y-b.y);
        }
        Point operator -= (const Point &b)
        {
            x-=b.x,y-=b.y;
            return *this;
        }
        friend double cross(const Point &a,const Point &b)
        {
            return a.x*b.y-a.y*b.x;
        }
        friend double dot(const Point &a,const Point &b)
        {
            return a.x*b.x+a.y*b.y;
        }
        friend bool operator == (const Point &a,const Point &b)
        {
            return equal(a.x,b.x)&&equal(a.y,b.y);
        }
        friend bool operator != (const Point &a,const Point &b)
        {
            return (!equal(a.x,b.x))||(!equal(a.y,b.y));
        }
        friend bool operator < (const Point &a,const Point &b)
        {
            if(equal(a.x,b.x)) return less(a.y,b.y);
            else return less(a.x,b.x);
        }
        friend bool operator > (const Point &a,const Point &b)
        {
            if(equal(a.x,b.x)) return greater(a.y,b.y);
            else return greater(a.x,b.x);
        }
        friend bool operator <= (const Point &a,const Point &b)
        {
            if(equal(a.x,b.x)) return less_equal(a.y,b.y);
            else return less_equal(a.x,b.x);
        }
        friend bool operator >= (const Point &a,const Point &b)
        {
            if(equal(a.x,b.x)) return greater_equal(a.y,b.y);
            else return greater_equal(a.x,b.x);
        }
        Point operator - ()const
        {
            return Point(-x,-y);
        }
        double length()const
        {
            return sqrt(x*x+y*y);
        }
        Point unit()const
        {
            return *this/length();
        }
        double angle()const
        {
            return atan2(y,x);
        }
        int quadrant()const
        {
            if(x>0&&y>=0) return 1;
            else if(x<=0&&y>0) return 2;
            else if(x<0&&y<=0) return 3;
            else if(x>=0&&y<0) return 4;
            else return 0;
        }
        friend double angle(const Point &a,const Point &b)
        {
            return atan2(cross(a,b),dot(a,b));
        }
        Point rotate(const double &theta)const
        {
            return Point(x*cos(theta)-y*sin(theta),x*sin(theta)+y*cos(theta));
        }
        friend istream &operator>>(istream &in,Point &obj)
        {
            in>>obj.x>>obj.y;
            return in;
        }
        friend ostream &operator<<(ostream &out,const Point &obj)
        {
            out<<obj.x<<" "<<obj.y;
            return out;
        }
    };
    bool cmp_polar_angle(const Point &a,const Point &b)
    {
        int x=a.quadrant(),y=b.quadrant();
        if(x!=y) return x<y;
        return cross(a,b)>0;
    };
    double distance(const Point &a,const Point &b)
    {
        return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
    }
    enum Direction
    {
        COUNTER_CLOCKWISE,
        CLOCKWISE,
        ONLINE_BACK,
        ONLINE_FRONT,
        ON_SEGMENT
    };
    istream& operator>>(istream& in,Direction& direction)
    {
        string value;
        in>>value;
        if(value=="COUNTER_CLOCKWISE") direction=COUNTER_CLOCKWISE;
        else if(value=="CLOCKWISE") direction=CLOCKWISE;
        else if(value=="ONLINE_BACK") direction=ONLINE_BACK;
        else if(value=="ONLINE_FRONT") direction=ONLINE_FRONT;
        else if(value=="ON_SEGMENT") direction=ON_SEGMENT;
        else in.setstate(ios::failbit);
        return in;
    }
    ostream& operator<<(ostream& out,const Direction& direction)
    {
        if(direction==COUNTER_CLOCKWISE) out<<"COUNTER_CLOCKWISE";
        else if(direction==CLOCKWISE) out<<"CLOCKWISE";
        else if(direction==ONLINE_BACK) out<<"ONLINE_BACK";
        else if(direction==ONLINE_FRONT) out<<"ONLINE_FRONT";
        else if(direction==ON_SEGMENT) out<<"ON_SEGMENT";
        return out;
    }
    class Line
    {
    public:
        Point a,b;
        Line(){}
        Line(const Point &_a,const Point &_b):a(_a),b(_b){}
        Point projection(const Point &p)const
        {
            return a+(b-a).unit()*(dot(p-a,b-a)/(b-a).length());
        }
        Point reflection(const Point &p)const
        {
            return projection(p)*2-p;
        }
        Direction direction(const Point &p)const
        {
            double t=cross(b-a,p-a);
            if(greater(t,0)) return COUNTER_CLOCKWISE;
            if(less(t,0)) return CLOCKWISE;
            double l1=dot(p-a,b-a);
            if(less(l1,0)) return ONLINE_BACK;
            double l2=dot(b-a,b-a);
            if(greater(l1,l2)) return ONLINE_FRONT;
            else return ON_SEGMENT;
        }
        double distance(const Point &p)const
        {
            Point u=projection(p);
            if(direction(u)==ON_SEGMENT) return Geometry::distance(u,p);
            else return min(Geometry::distance(a,p),Geometry::distance(b,p));
        }
        Point middle_point()const
        {
            return (a+b)/2;
        }
        Line perpendicular_bisector()const
        {
            Point p=middle_point();
            return Line(p,p+(b-a).rotate(PI/2));
        }
        double length()const
        {
            return Geometry::distance(a,b);
        }
        friend istream &operator>>(istream &in,Line &obj)
        {
            in>>obj.a>>obj.b;
            return in;
        }
        friend ostream &operator<<(ostream &out,const Line &obj)
        {
            out<<obj.a<<" "<<obj.b;
            return out;
        }
    };
    bool parallel(const Line &x,const Line &y)
    {
        return equal(cross(x.b-x.a,y.b-y.a),0);
    }
    bool orthogonal(const Line &x,const Line &y)
    {
        return equal(dot(x.b-x.a,y.b-y.a),0);
    }
    vector<Point> cross_point(const Line &x,const Line &y)
    {
        if(parallel(x,y)) return {};
        Point u=x.a-y.a,v=x.b-x.a,w=y.b-y.a;
        double t=cross(w,u)/cross(v,w);
        return {x.a+t*v};
    }
    int sgn(double x)
    {
        return greater(x,0)-less(x,0);
    }
    bool intersection(const Line &x,const Line &y)
    {
        if(x.direction(y.a)==ON_SEGMENT||x.direction(y.b)==ON_SEGMENT||y.direction(x.a)==ON_SEGMENT||y.direction(x.b)==ON_SEGMENT) return true;
        return sgn(cross(x.b-x.a,y.a-x.a))*sgn(cross(x.b-x.a,y.b-x.a))<0&&sgn(cross(y.b-y.a,x.a-y.a))*sgn(cross(y.b-y.a,x.b-y.a))<0;
    }
    double distance(const Line &x,const Line &y)
    {
        if(intersection(x,y)) return 0;
        else return min({x.distance(y.a),x.distance(y.b),y.distance(x.a),y.distance(x.b)});
    }
    const int IN=2,ON=1,OUT=0;
    mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
    class Polygon
    {
    private:
        vector<Point>g;
    public:
        Polygon(){}
        Polygon(const int &n){g.resize(n);}
        Polygon(const vector<Point> &f):g(f){}
        void clear()
        {
            g.clear();
        }
        void resize(int n)
        {
            g.resize(n);
        }
        void push_back(const Point &x)
        {
            return g.push_back(x);
        }
        void push_back(const vector<Point> &x)
        {
            for(const Point &p:x)
                g.push_back(p);
            return;
        }
        void pop_back()
        {
            return g.pop_back();
        }
        Point& front()
        {
            return g.front();
        }
        const Point& front()const
        {
            return g.front();
        }
        Point& back()
        {
            return g.back();
        }
        const Point& back()const
        {
            return g.back();
        }
        size_t size()const
        {
            return g.size();
        }
        Point& operator [](const int &i)
        {
            return g[i];
        }
        const Point& operator [](const int &i)const
        {
            return g[i];
        }
        vector<Point>::iterator begin()
        {
            return g.begin();
        }
        vector<Point>::iterator end()
        {
            return g.end();
        }
        vector<Point>::const_iterator begin()const
        {
            return g.begin();
        }
        vector<Point>::const_iterator end()const
        {
            return g.end();
        }
        vector<Point>::reverse_iterator rbegin()
        {
            return g.rbegin();
        }
        vector<Point>::reverse_iterator rend()
        {
            return g.rend();
        }
        vector<Point>::const_reverse_iterator rbegin()const
        {
            return g.rbegin();
        }
        vector<Point>::const_reverse_iterator rend()const
        {
            return g.rend();
        }
        double area()const
        {
            int n=g.size();
            double res=0;
            for(int i=0;i<n;i++)
                res+=cross(g[i],g[(i+1)%n]);
            res/=2;
            return abs(res);
        }
        double perimeter()const
        {
            int n=g.size();
            double sum=0;
            for(int i=0;i<n;i++)
                sum+=distance(g[i],g[(i+1)%n]);
            return sum;
        }
        bool is_convex()const
        {
            int n=g.size();
            for(int i=0;i<n;i++)
                if(less(cross(g[(i+1)%n]-g[i],g[(i-1+n)%n]-g[i]),0)) return false;
            return true;
        }
        int point_containment(const Point &a)const
        {
            int n=g.size();
            for(int i=0;i<n;i++)
                if(Line(g[i],g[(i+1)%n]).direction(a)==ON_SEGMENT) return ON;
            function<bool(const Line &)> check=[&](const Line &l)
            {
                for(int i=0;i<n;i++)
                    if(parallel(l,Line(g[i],g[(i+1)%n]))) return false;
                for(int i=0;i<n;i++)
                    if(l.direction(g[i])==ON_SEGMENT||l.direction(g[i])==ONLINE_FRONT||l.direction(g[i])==ONLINE_BACK) return false;
                return true;
            };
            Line l=Line(a,Point(rnd(),rnd()));
            while(!check(l))
                l=Line(a,Point(rnd(),rnd()));
            int s=0;
            for(int i=0;i<n;i++)
                if(intersection(l,Line(g[i],g[(i+1)%n]))) s++;
            if(s&1) return IN;
            else return OUT;
        }
        double convex_diamater()const
        {
            int n=g.size();
            double ans=0;
            for(int i=0,j=2;i<n;i++)
            {
                while(less(cross(g[i]-g[j],g[(i+1)%n]-g[j]),cross(g[i]-g[(j+1)%n],g[(i+1)%n]-g[(j+1)%n]))) j=(j+1)%n;
                ans=max(ans,max(distance(g[j],g[i]),distance(g[j],g[(i+1)%n])));
            }
            return ans;
        }
        pair<Polygon,Polygon> convex_cut(const Line &l)const
        {
            Polygon res1,res2;
            int n=g.size();
            for(int i=0;i<(int)g.size();i++)
            {
                Point u=g[i],v=g[(i+1)%n];
                if(greater_equal(cross(l.b-l.a,u-l.a),0))
                {
                    res1.push_back(u);
                    if(less(cross(l.b-l.a,v-l.a),0)) res1.push_back(cross_point(Line(u,v),l));
                }
                else if(greater(cross(l.b-l.a,v-l.a),0)) res1.push_back(cross_point(Line(u,v),l));
            }
            for(int i=0;i<(int)g.size();i++)
            {
                Point u=g[i],v=g[(i+1)%n];
                if(greater_equal(cross(l.a-l.b,u-l.b),0))
                {
                    res2.push_back(u);
                    if(less(cross(l.a-l.b,v-l.b),0)) res2.push_back(cross_point(Line(u,v),l));
                }
                else if(greater(cross(l.a-l.b,v-l.b),0)) res2.push_back(cross_point(Line(u,v),l));
            }
            return make_pair(res1,res2);
        }
        Polygon kernel()const;
    };
    Polygon convex_hull(const vector<Point> &p)
    {
        int n=p.size();
        if(n<=2)
        {
            Polygon res;
            for(int i=0;i<n;i++)
                res.push_back(p[i]);
            return res;
        }
        vector<int>id(n);
        iota(id.begin(),id.end(),0);
        sort(id.begin(),id.end(),[&](const int &a,const int &b){return p[a].x==p[b].x?p[a].y<p[b].y:p[a].x<p[b].x;});
        vector<int>stk;
        int top=0;
        for(int i=0;i<n;i++)
        {
            while(top>=2&&less_equal(cross(p[stk[top-1]]-p[stk[top-2]],p[id[i]]-p[stk[top-1]]),0)) stk.pop_back(),top--;
            stk.emplace_back(id[i]),top++;
        }
        int tmp=top;
        for(int i=n-2;i>=0;i--)
        {
            while(top>tmp&&less_equal(cross(p[stk[top-1]]-p[stk[top-2]],p[id[i]]-p[stk[top-1]]),0)) stk.pop_back(),top--;
            stk.emplace_back(id[i]),top++;
        }
        stk.pop_back(),top--;
        vector<int> hull;
        for(int i=0;i<top;i++)
            hull.emplace_back(stk[i]);
        Polygon res;
        for(int u:hull)
            res.push_back(p[u]);
        return res;
    }
    Polygon non_strictly_convex_hull(const vector<Point> &p)
    {
        int n=p.size();
        if(n<=2)
        {
            Polygon res;
            for(int i=0;i<n;i++)
                res.push_back(p[i]);
            return res;
        }
        vector<int>id(n);
        iota(id.begin(),id.end(),0);
        sort(id.begin(),id.end(),[&](const int &a,const int &b){return p[a].x==p[b].x?p[a].y<p[b].y:p[a].x<p[b].x;});
        vector<int>stk;
        int top=0;
        for(int i=0;i<n;i++)
        {
            while(top>=2&&less(cross(p[stk[top-1]]-p[stk[top-2]],p[id[i]]-p[stk[top-1]]),0)) stk.pop_back(),top--;
            stk.emplace_back(id[i]),top++;
        }
        int tmp=top;
        for(int i=n-2;i>=0;i--)
        {
            while(top>tmp&&less(cross(p[stk[top-1]]-p[stk[top-2]],p[id[i]]-p[stk[top-1]]),0)) stk.pop_back(),top--;
            stk.emplace_back(id[i]),top++;
        }
        stk.pop_back(),top--;
        vector<int> hull;
        for(int i=0;i<top;i++)
            hull.emplace_back(stk[i]);
        Polygon res;
        for(int u:hull)
            res.push_back(p[u]);
        return res;
    }
    Polygon minkowski_sum(const vector<Point> &a,const vector<Point> &b)
    {
        assert(a.size()!=0&&b.size()!=0);
        Polygon ca=convex_hull(a),cb=convex_hull(b);
        int na=ca.size(),nb=cb.size();
        vector<Point>la,lb;
        for(int i=0;i<na;i++)
            la.emplace_back(ca[(i+1)%na]-ca[i]);
        for(int i=0;i<nb;i++)
            lb.emplace_back(cb[(i+1)%nb]-cb[i]);
        int pa=0,pb=0;
        vector<Point> l;
        l.emplace_back(ca[0]+cb[0]);
        while(pa<(int)la.size()&&pb<(int)lb.size())
        {
            double val=cross(la[pa],lb[pb]);
            if(greater(val,0)) l.emplace_back(l.back()+la[pa]),pa++;
            else if(less(val,0)) l.emplace_back(l.back()+lb[pb]),pb++;
            else l.emplace_back(l.back()+la[pa]+lb[pb]),pa++,pb++;
        }
        while(pa<(int)la.size())
            l.emplace_back(l.back()+la[pa]),pa++;
        while(pb<(int)lb.size())
            l.emplace_back(l.back()+lb[pb]),pb++;
        Polygon res=convex_hull(l);
        return res;
    }
    Polygon half_plane_intersection(const vector<Line> &l,double x1=-INF,double y1=-INF,double x2=INF,double y2=INF)
    {
        vector<pair<double,Line>>f;
        for(int i=0;i<(int)l.size();i++)
            f.emplace_back((l[i].b-l[i].a).angle(),l[i]);
        f.emplace_back(0,Line(Point(x1,y1),Point(x2,y1)));
        f.emplace_back(PI/2,Line(Point(x2,y1),Point(x2,y2)));
        f.emplace_back(PI,Line(Point(x2,y2),Point(x1,y2)));
        f.emplace_back(-PI/2,Line(Point(x1,y2),Point(x1,y1)));
        int n=f.size();
        sort(f.begin(),f.end(),[](const pair<double,Line> &a,const pair<double,Line> &b){return !equal(a.first,b.first)?a.first<b.first:a.second.direction(b.second.a)==CLOCKWISE;});
        vector<Line>Ql(n);
        vector<Point>Qp(n);
        Polygon res;
        int head=0,tail=-1;
        Ql[++tail]=f[0].second;
        for(int i=1;i<n;i++)
            if(!equal(f[i].first,f[i-1].first))
            {
                while(head<tail&&f[i].second.direction(Qp[tail-1])==CLOCKWISE) tail--;
                while(head<tail&&f[i].second.direction(Qp[head])==CLOCKWISE) head++;
                Ql[++tail]=f[i].second;
                if(head<tail)
                {
                    vector<Point> tmp=cross_point(Ql[tail],Ql[tail-1]);
                    if(!tmp.empty()) Qp[tail-1]=tmp[0];
                    else return res;
                }
            }
        while(head<tail&&Ql[head].direction(Qp[tail-1])==CLOCKWISE) tail--;
        while(head<tail&&Ql[tail].direction(Qp[head])==CLOCKWISE) head++;
        vector<Point> tmp=cross_point(Ql[tail],Ql[head]);
        if(tmp.empty()||tail-head+1<=2) return res;
        for(int i=head;i<tail;i++)
            res.push_back(Qp[i]);
        res.push_back(tmp[0]);
        return res;
    }
    Polygon Polygon::kernel()const
    {
        int n=g.size();
        vector<Line>l;
        for(int i=0;i<n;i++)
            l.emplace_back(Line(g[i],g[(i+1)%n]));
        return half_plane_intersection(l);
    }
    double closest_pair(const vector<Point> &_p)
    {
        vector<Point>p=_p;
        sort(p.begin(),p.end(),[](const Point &a,const Point &b){return a.x<b.x;});
        function<double(const int &,const int &)> solve=[&](const int &l,const int &r)
        {
            if(r-l+1<=1) return INF;
            if(r-l+1<=7)
            {
                double ans=INF;
                sort(p.begin()+l,p.begin()+r+1,[](const Point &a,const Point &b){return a.y<b.y;});
                for(int i=l;i<=r;i++)
                    for(int j=i+1;j<=r;j++)
                        ans=min(ans,distance(p[i],p[j]));
                return ans;
            }
            int mid=(l+r)/2;
            double w=p[mid].x;
            double d=min(solve(l,mid),solve(mid+1,r));
            inplace_merge(p.begin()+l,p.begin()+mid+1,p.begin()+r+1,[](const Point &a,const Point &b){return a.y<b.y;});
            vector<Point>q;
            for(int i=l;i<=r;i++)
                if(abs(w-p[i].x)<=d) q.emplace_back(p[i]);
            for(int i=0,j=0;i<(int)q.size();i++)
            {
                while(j<(int)q.size()&&q[j].y<=q[i].y+d) j++;
                for(int k=i+1;k<j;k++)
                    d=min(d,distance(q[i],q[k]));
            }
            return d;
        };
        return solve(0,p.size()-1);
    }
    class Circle
    {
    public:
        Point o;
        double r;
        Circle(){}
        Circle(const Point &_o,const double &_r):o(_o),r(_r){}
        friend istream &operator>>(istream &in,Circle &obj)
        {
            in>>obj.o>>obj.r;
            return in;
        }
        friend ostream &operator<<(ostream &out,const Circle &obj)
        {
            out<<obj.o<<" "<<obj.r;
            return out;
        }
        friend bool operator==(const Circle &a,const Circle &b)
        {
            return a.o==b.o&&equal(a.r,b.r); 
        }
        friend bool operator!=(const Circle &a,const Circle &b)
        {
            return a.o!=b.o||(!equal(a.r,b.r)); 
        }
        double area()const
        {
            return PI*r*r;
        }
        bool is_tangent(const Line &l)const
        {
            return equal(Geometry::distance(l.projection(o),o),r);
        }
        int point_containment(const Point &p)const
        {
            double d=distance(o,p);
            if(equal(d,r)) return ON;
            else if(less(d,r)) return IN;
            else return OUT;
        }
        vector<Point>cross_point(const Line &l)const
        {
            Point pr=l.projection(o),e=(l.b-l.a).unit();
            double d=distance(pr,o);
            if(greater(d,r)) return {};
            double t=sqrt(r*r-distance(pr,o)*distance(pr,o));
            if(equal(t,0)) return {pr};
            else return {pr-e*t,pr+e*t};
        }
        vector<Point>cross_point(const Circle &c)const
        {
            double d=distance(o,c.o);
            if(less(d,abs(r-c.r))||greater(d,r+c.r)) return {};
            double x=(r*r-c.r*c.r+d*d)/(d*2),h=sqrt(r*r-x*x);
            Point p=o+(c.o-o).unit()*x;
            if(equal(d,abs(r-c.r))||equal(d,r+c.r)) return {p};
            Point v=(c.o-o).unit().rotate(PI/2)*h;
            return {p-v,p+v};
        }
        vector<Point>tangent(const Point &p)const
        {
            double d=distance(o,p);
            if(greater(r,d)) return {};
            if(equal(d,r)) return {p};
            return cross_point(Circle(p,sqrt(d*d-r*r)));
        }
        vector<Line>common_tangent_out(const Circle &c)const
        {
            assert(*this!=c);
            if(equal(r,c.r))
            {
                Point p=(c.o-o).unit().rotate(PI/2)*r;
                return {Line(o-p,c.o-p),Line(o+p,c.o+p)};
            }
            double d=distance(o,c.o);
            if(less(d,abs(r-c.r))) return {};
            if(equal(d,abs(r-c.r)))
            {
                Point p;
                if(r>c.r) p=o+(c.o-o).unit()*r;
                else p=c.o+(o-c.o).unit()*c.r;
                return {Line(p,p)}; 
            }
            Point p((o.x*c.r-c.o.x*r)/(c.r-r),(o.y*c.r-c.o.y*r)/(c.r-r));
            vector<Point>p1=tangent(p),p2=c.tangent(p);
            assert((int)p1.size()==2&&(int)p2.size()==2);
            return {Line(p1[0],p2[0]),Line(p1[1],p2[1])};
        }
        vector<Line>common_tangent_in(const Circle &c)const
        {
            assert(*this!=c);
            double d=distance(o,c.o);
            if(less(d,abs(r+c.r))) return {};
            if(equal(d,abs(r+c.r)))
            {
                Point p=o+(c.o-o).unit()*r;
                return {Line(p,p)}; 
            }
            Point p((o.x*c.r+c.o.x*r)/(r+c.r),(o.y*c.r+c.o.y*r)/(r+c.r));
            vector<Point>p1=tangent(p),p2=c.tangent(p);
            assert((int)p1.size()==2&&(int)p2.size()==2);
            return {Line(p1[0],p2[0]),Line(p1[1],p2[1])};
        }
        vector<Line>common_tangent(const Circle &c)const
        {
            assert(*this!=c);
            vector<Line>f=common_tangent_out(c),g=common_tangent_in(c);
            for(const Line &l:g)
                f.emplace_back(l);
            g.clear();
            sort(f.begin(),f.end(),[](const Line &x,const Line &y){return x.a.x<y.a.x||(x.a.x==x.a.x&&x.a.y<x.a.y);});
            return f;
        }
        double intersection_area(const Point &a,const Point &b)const
        {
            bool ta=less_equal(distance(o,a),r),tb=less_equal(distance(o,b),r);
            if(ta&&tb) return cross(a-o,b-o)/2;
            vector<Point>t=cross_point(Line(b,a));
            if(ta&&!tb) return angle(t.front()-o,b-o)*r*r/2+cross(a-o,t.front()-o)/2;
            if(!ta&&tb) return angle(a-o,t.back()-o)*r*r/2+cross(t.back()-o,b-o)/2;
            double s=angle(a-o,b-o)*r*r/2;
            if(greater_equal(Line(a,b).distance(o),r)) return s;
            return s+angle(t.front()-o,t.back()-o)*r*r/2-cross(t.front()-o,t.back()-o)/2;
        }
        double intersection_area(const Polygon &g)const
        {
            int n=g.size();
            double s=0;
            for(int i=0;i<n;i++)
                s+=intersection_area(g[i],g[(i+1)%n]);
            return s;
        }
        double intersection_area(const Circle &c)const
        {
            double d=distance(o,c.o);
            if(greater(d,r+c.r)) return 0;
            if(less_equal(d,abs(r-c.r))) return min(area(),c.area());
            vector<Point>t=cross_point(c);
            double alpha=acos((d*d+r*r-c.r*c.r)/(2*d*r))*2,beta=acos((d*d+c.r*c.r-r*r)/(2*d*c.r))*2;
            double s1=alpha*r*r/2,s2=beta*c.r*c.r/2,s3=sin(alpha)*r*r/2+sin(beta)*c.r*c.r/2;
            return s1+s2-s3;
        }
    };
    const int SEPARATED=4,CIRCUMSCRIBED=3,INTERSECTED=2,INSCRIBED=1,INCLUDED=0;
    int intersection(const Circle &a,const Circle &b)
    {
        double d=distance(a.o,b.o);
        if(greater(d,a.r+b.r)) return SEPARATED;
        else if(equal(d,a.r+b.r)) return CIRCUMSCRIBED;
        else if(greater(d,abs(a.r-b.r))) return INTERSECTED;
        else if(equal(d,abs(a.r-b.r))) return INSCRIBED;
        else return INCLUDED;
    }
    class Triangle
    {
    public:
        Point A,B,C;
        Triangle(){}
        Triangle(const Point &_A,const Point &_B,const Point &_C):A(_A),B(_B),C(_C){}
        friend istream &operator>>(istream &in,Triangle &obj)
        {
            in>>obj.A>>obj.B>>obj.C;
            return in;
        }
        friend ostream &operator<<(ostream &out,const Triangle &obj)
        {
            out<<obj.A<<" "<<obj.B<<" "<<obj.C;
            return out;
        }
        Circle inscribed_circle()const
        {
            double a=distance(B,C),b=distance(A,C),c=distance(A,B);
            double p=(a+b+c)/2;
            double s=abs(cross(B-A,C-A))/2;
            double r=s/p;
            Point o((a*A.x+b*B.x+c*C.x)/(a+b+c),(a*A.y+b*B.y+c*C.y)/(a+b+c));
            return Circle(o,r);
        }
        Circle circumscribed_circle()const
        {
            double t1=A.x*A.x+A.y*A.y;
            double t2=B.x*B.x+B.y*B.y;
            double t3=C.x*C.x+C.y*C.y;
            double t=A.x*B.y+B.x*C.y+C.x*A.y-A.x*C.y-B.x*A.y-C.x*B.y;
            Point o((t2*C.y+t1*B.y+t3*A.y-t2*A.y-t3*B.y-t1*C.y)/t/2,(t3*B.x+t2*A.x+t1*C.x-t1*B.x-t2*C.x-t3*A.x)/t/2);
            double a=distance(B,C),b=distance(A,C),c=distance(A,B);
            double s=abs(cross(B-A,C-A))/2;
            double r=a*b*c/(4*s);
            return Circle(o,r);
        }
    };
    Circle smallest_enclosing_circle(const vector<Point> &_p)
    {
        vector<Point>p=_p;
        shuffle(p.begin(),p.end(),rnd);
        int n=p.size();
        Circle c=Circle(Point(0,0),0);
        for(int i=0;i<n;i++)
            if(c.point_containment(p[i])==OUT)
            {
                c=Circle(p[i],0);
                for(int j=0;j<i;j++)
                    if(c.point_containment(p[j])==OUT)
                    {
                        c=Circle((p[i]+p[j])/2,distance(p[i],p[j])/2);
                        for(int k=0;k<j;k++)
                            if(c.point_containment(p[k])==OUT)
                                c=Triangle(p[i],p[j],p[k]).circumscribed_circle();
                    }
            }
        return c;
    }
}
using namespace Geometry;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int n;
    cin>>n;
    Polygon g(n);
    for(int i=0;i<n;i++)
        cin>>g[i];
    double ans=g.convex_diamater();
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3964kb

input:

1000
0 0
-997615 -8573
-1988394 -28911
-2726572 -44296
-3491635 -60392
-4419752 -82814
-5298550 -105946
-5723430 -118453
-6608257 -147267
-7034966 -161982
-7563964 -181682
-8507871 -222865
-9499799 -271846
-10090186 -303547
-10400262 -322989
-10614073 -339725
-11081438 -378596
-11791568 -439127
-127...

output:

274339223.1895614266

result:

ok found '274339223.1895614', expected '274339223.1895614', error '0.0000000'

Test #2:

score: 10
Accepted
time: 1ms
memory: 4020kb

input:

1000
0 0
-887614 -1937
-1459359 -3808
-2421409 -24096
-3273181 -48456
-3917594 -76664
-4402753 -100164
-5375022 -150897
-5993935 -192089
-6587159 -238825
-7549680 -333298
-8330993 -416479
-9244392 -515027
-10010900 -598589
-10374584 -640275
-10767641 -686907
-11173081 -741316
-11821952 -833327
-1260...

output:

262687047.9274906218

result:

ok found '262687047.9274906', expected '262687047.9274906', error '0.0000000'

Test #3:

score: 10
Accepted
time: 1ms
memory: 3964kb

input:

1000
0 0
-631055 -2758
-1328409 -7463
-2248672 -20536
-2412978 -23564
-2659543 -28441
-3383179 -43406
-4183375 -64326
-4856658 -88337
-5799682 -134822
-6757348 -189404
-7132846 -212164
-7563226 -242116
-8368716 -300012
-9321463 -381770
-9831821 -432746
-10409503 -491057
-11360852 -607259
-11874199 -...

output:

257868038.6435896754

result:

ok found '257868038.6435897', expected '257868038.6435897', error '0.0000000'

Test #4:

score: 10
Accepted
time: 1ms
memory: 3960kb

input:

1000
0 0
-48652 -588
-951356 -20091
-1517426 -33325
-1965414 -51971
-2466111 -74904
-3046762 -103888
-3555833 -132002
-3976901 -156059
-4972848 -245498
-5921476 -332492
-6353035 -375491
-7327511 -496188
-7939064 -575429
-8842272 -694656
-9246222 -756797
-9771758 -860630
-10633761 -1031205
-10981774 ...

output:

259539672.4804533720

result:

ok found '259539672.4804534', expected '259539672.4804534', error '0.0000000'

Test #5:

score: 10
Accepted
time: 1ms
memory: 3924kb

input:

1000
0 0
-456569 -2668
-1141521 -7887
-1270801 -8967
-1971135 -21206
-2919889 -38188
-3903859 -71231
-4752603 -107450
-5508682 -143873
-6214620 -183392
-6718977 -212193
-7452291 -271600
-8408796 -354998
-9261882 -432674
-9528618 -457608
-10099091 -513153
-10320120 -535958
-11067358 -614356
-12050731...

output:

250217366.4826218486

result:

ok found '250217366.4826218', expected '250217366.4826218', error '0.0000000'

Test #6:

score: 10
Accepted
time: 1ms
memory: 3904kb

input:

1000
0 0
-794019 -17307
-1389128 -41522
-1928884 -68000
-2530256 -103641
-3335109 -158872
-4273633 -225636
-4655012 -253747
-5584931 -329387
-6190262 -382029
-6657521 -422826
-7445510 -497270
-8092482 -562235
-8879759 -646264
-9688106 -745847
-10545954 -857573
-11350736 -962711
-12106702 -1066386
-1...

output:

256130723.0053679943

result:

ok found '256130723.0053680', expected '256130723.0053680', error '0.0000000'

Test #7:

score: 10
Accepted
time: 1ms
memory: 3916kb

input:

1000
0 0
-785524 -1241
-1228373 -2123
-1584480 -5108
-2516949 -19826
-3109735 -51256
-3799285 -95138
-4215892 -125263
-5144743 -202941
-6071171 -287679
-6844072 -376760
-7786583 -487933
-8491316 -575443
-9458832 -700691
-9848966 -756816
-10135682 -798578
-11100151 -940696
-11527785 -1004652
-1221960...

output:

268992022.0570692420

result:

ok found '268992022.0570692', expected '268992022.0570692', error '0.0000000'

Test #8:

score: 10
Accepted
time: 1ms
memory: 4012kb

input:

1000
0 0
-787651 -697
-1319793 -8691
-1545057 -12462
-2239671 -24650
-2487763 -36810
-2983386 -61694
-3408212 -85910
-3650815 -105325
-4268088 -155258
-5088483 -225550
-5720403 -280762
-6036913 -309102
-6663280 -365291
-7656626 -456948
-8462737 -538137
-9318271 -628471
-9704990 -671367
-10363047 -74...

output:

251395356.7229873240

result:

ok found '251395356.7229873', expected '251395356.7229873', error '0.0000000'

Test #9:

score: 10
Accepted
time: 1ms
memory: 3884kb

input:

1000
0 0
-895815 -18037
-1536713 -40507
-2439825 -73040
-2896761 -94230
-3815334 -138606
-4520738 -176711
-4997585 -208924
-5399492 -237632
-5629592 -254751
-6518310 -320902
-7084766 -367663
-7724052 -423029
-8475256 -492590
-9071702 -551527
-9798581 -626155
-10535448 -702512
-11155572 -768931
-1208...

output:

259639018.6166957319

result:

ok found '259639018.6166957', expected '259639018.6166958', error '0.0000000'

Test #10:

score: 10
Accepted
time: 1ms
memory: 3920kb

input:

1000
0 0
-837332 -2192
-1593910 -10845
-2320576 -25425
-3294539 -45660
-4178010 -82673
-4936159 -128518
-5796274 -190640
-6313517 -228540
-7131129 -291797
-7751205 -354513
-8357330 -419926
-9355375 -542247
-9783911 -596434
-10313681 -667126
-10377189 -675659
-10824619 -750345
-11653618 -894218
-1234...

output:

267554454.1762451231

result:

ok found '267554454.1762451', expected '267554454.1762451', error '0.0000000'

Test #11:

score: 10
Accepted
time: 0ms
memory: 3908kb

input:

1000
0 0
-758133 -3909
-1146524 -7212
-1823781 -16200
-2561994 -26923
-3448934 -43815
-4337557 -80953
-4912706 -106752
-5770093 -182352
-6645519 -261073
-7156648 -309532
-7882740 -380211
-8731241 -470527
-9265139 -532092
-10083113 -633235
-10767248 -721935
-11729364 -862416
-12112647 -921658
-128310...

output:

259903024.7335910201

result:

ok found '259903024.7335910', expected '259903024.7335910', error '0.0000000'

Test #12:

score: 10
Accepted
time: 1ms
memory: 3932kb

input:

1000
0 0
-220082 -1509
-1148190 -9207
-2108923 -22196
-2713299 -30623
-3364648 -43866
-3891571 -54675
-4300261 -63335
-4622311 -72814
-5235380 -91992
-5680720 -106355
-6138401 -121807
-7013302 -160828
-7784753 -195568
-8750494 -245022
-9681201 -295430
-10320328 -334255
-11256371 -407963
-12199734 -4...

output:

261658565.5826949477

result:

ok found '261658565.5826949', expected '261658565.5826949', error '0.0000000'

Test #13:

score: 10
Accepted
time: 1ms
memory: 3884kb

input:

1000
0 0
-425515 -4558
-1293469 -14675
-1990220 -30271
-2703160 -49015
-3455818 -76450
-4210140 -107243
-4530367 -120805
-5136478 -158180
-5732363 -196472
-6247394 -230823
-7100635 -290064
-7703961 -335663
-8091361 -368200
-8752153 -427341
-9433796 -491521
-10139006 -563945
-10984402 -653149
-113386...

output:

256353710.9730163217

result:

ok found '256353710.9730163', expected '256353710.9730163', error '0.0000000'

Test #14:

score: 10
Accepted
time: 1ms
memory: 3920kb

input:

1000
0 0
-572806 -2255
-1477072 -15611
-1643871 -18681
-2578790 -51107
-3303402 -86192
-4032032 -123256
-4540711 -150307
-5462171 -206756
-6377222 -264514
-6921545 -316752
-7623842 -390821
-8329739 -466169
-9034451 -568935
-9600887 -653814
-9729771 -674650
-10461476 -795876
-11348904 -952387
-117122...

output:

255498134.5157807171

result:

ok found '255498134.5157807', expected '255498134.5157807', error '0.0000000'

Test #15:

score: 10
Accepted
time: 1ms
memory: 3920kb

input:

1000
0 0
-723350 -3997
-1405147 -10223
-2296494 -21394
-2876280 -32357
-3572827 -51397
-4452032 -87137
-4953249 -111910
-5388609 -141252
-5731586 -165403
-6101332 -197003
-6884756 -282055
-7719066 -372715
-8101214 -415308
-8855617 -516206
-9316024 -579909
-10091662 -705732
-10621099 -799022
-1137369...

output:

258992362.5300114155

result:

ok found '258992362.5300114', expected '258992362.5300114', error '0.0000000'

Test #16:

score: 10
Accepted
time: 1ms
memory: 3900kb

input:

1000
0 0
-638945 -769
-1345094 -2633
-2049372 -9786
-3043001 -20660
-3832821 -40968
-4616354 -61996
-5489016 -89554
-6075577 -112116
-7059918 -153506
-7917375 -193461
-8704241 -235730
-9411173 -289585
-9928254 -332456
-10816688 -407937
-11522358 -469782
-12333778 -541183
-12532282 -560003
-13293480 ...

output:

260884926.0498460531

result:

ok found '260884926.0498461', expected '260884926.0498461', error '0.0000000'

Test #17:

score: 10
Accepted
time: 1ms
memory: 3912kb

input:

1000
0 0
-929784 -9273
-1222089 -14360
-1633168 -22589
-2271669 -42262
-2863939 -61639
-3538074 -85549
-4537727 -127500
-5529674 -172462
-6106076 -217405
-6615381 -262810
-7383575 -342936
-8289266 -445052
-8474592 -467243
-9285779 -564519
-10059545 -662251
-10774681 -753541
-11666601 -869701
-120587...

output:

259788149.3996045291

result:

ok found '259788149.3996045', expected '259788149.3996045', error '0.0000000'

Test #18:

score: 10
Accepted
time: 1ms
memory: 3848kb

input:

1000
0 0
-436597 -2249
-897574 -4839
-1763026 -9858
-2199595 -14239
-2837069 -24431
-3656371 -67025
-4153771 -93216
-5062244 -151716
-5634320 -190859
-6503474 -278174
-7250273 -366225
-7276046 -369834
-7806600 -448708
-8317734 -530915
-8905662 -634997
-9766507 -790590
-9973653 -831916
-10555366 -955...

output:

277834510.7780300379

result:

ok found '277834510.7780300', expected '277834510.7780300', error '0.0000000'

Test #19:

score: 10
Accepted
time: 1ms
memory: 4012kb

input:

1000
0 0
-499456 -5028
-1395210 -19193
-2095999 -36599
-2278240 -43145
-2754419 -63055
-3701264 -104359
-4078225 -133214
-4292562 -151446
-5087031 -220375
-5649235 -277762
-6403916 -358749
-7403700 -470022
-7940233 -537110
-8433330 -607694
-9376563 -746831
-9903004 -831307
-10718505 -965214
-1171369...

output:

261984352.6271107793

result:

ok found '261984352.6271108', expected '261984352.6271108', error '0.0000000'

Test #20:

score: 10
Accepted
time: 1ms
memory: 3920kb

input:

1000
0 0
-347123 -2330
-1296972 -12856
-2114794 -28811
-3005647 -54768
-3802579 -79440
-4777546 -118441
-5386348 -146049
-6230831 -184743
-7083665 -250364
-7963538 -324047
-8621014 -381656
-9065618 -421654
-9883960 -496406
-10349110 -541972
-11146897 -621572
-12108943 -718091
-12921588 -803916
-1348...

output:

265979549.5809911788

result:

ok found '265979549.5809912', expected '265979549.5809912', error '0.0000000'

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #21:

score: 30
Accepted
time: 9ms
memory: 3868kb

input:

30000
0 0
-27842 -9
-56782 -24
-64412 -29
-91618 -47
-121087 -68
-152541 -123
-182316 -183
-212916 -274
-234159 -341
-266126 -446
-289328 -523
-317883 -637
-340594 -728
-350940 -781
-374263 -905
-400736 -1046
-427862 -1199
-450458 -1327
-465289 -1413
-485809 -1534
-517032 -1724
-548368 -1921
-576015...

output:

254843548.6986402571

result:

ok found '254843548.6986403', expected '254843548.6986403', error '0.0000000'

Test #22:

score: 30
Accepted
time: 9ms
memory: 3992kb

input:

30000
0 0
-31209 -21
-39334 -27
-64601 -46
-86568 -64
-115119 -89
-143398 -117
-161108 -154
-179520 -196
-203131 -254
-234209 -335
-252923 -396
-275417 -473
-289767 -533
-311588 -627
-343100 -821
-369994 -998
-385492 -1101
-412257 -1281
-427669 -1387
-453860 -1575
-485750 -1817
-510891 -2019
-531160...

output:

250853956.0239689052

result:

ok found '250853956.0239689', expected '250853956.0239689', error '0.0000000'

Test #23:

score: 30
Accepted
time: 9ms
memory: 3940kb

input:

30000
0 0
-20075 -15
-53286 -46
-77410 -74
-104765 -117
-128452 -158
-138117 -176
-145933 -192
-169668 -264
-195119 -349
-220533 -437
-227177 -463
-259461 -594
-288461 -712
-304625 -788
-337671 -947
-358291 -1056
-388248 -1227
-411605 -1362
-422810 -1433
-444967 -1583
-464234 -1714
-471059 -1763
-48...

output:

250990461.7585058212

result:

ok found '250990461.7585058', expected '250990461.7585058', error '0.0000000'

Test #24:

score: 30
Accepted
time: 9ms
memory: 3996kb

input:

30000
0 0
-25406 -9
-53669 -24
-62096 -33
-84905 -59
-97980 -83
-118490 -127
-139980 -180
-168464 -256
-187325 -315
-208655 -393
-215588 -421
-244663 -541
-261958 -614
-288250 -735
-294235 -765
-308563 -838
-338619 -993
-350477 -1059
-363699 -1134
-379676 -1232
-398726 -1354
-430095 -1576
-459666 -1...

output:

253698546.2001740336

result:

ok found '253698546.2001740', expected '253698546.2001740', error '0.0000000'

Test #25:

score: 30
Accepted
time: 9ms
memory: 4000kb

input:

30000
0 0
-21134 -9
-45635 -23
-62583 -36
-90936 -72
-123048 -113
-148384 -151
-173729 -190
-194644 -225
-207752 -258
-236495 -342
-241543 -359
-272810 -476
-303141 -602
-324057 -690
-344614 -778
-364773 -871
-380490 -948
-407975 -1083
-433651 -1212
-464879 -1383
-485067 -1502
-513615 -1674
-537857 ...

output:

249331713.2810479105

result:

ok found '249331713.2810479', expected '249331713.2810479', error '0.0000000'

Test #26:

score: 30
Accepted
time: 9ms
memory: 3900kb

input:

30000
0 0
-21448 -2
-26656 -6
-55814 -36
-82967 -67
-107428 -97
-134427 -133
-152614 -158
-171092 -185
-199260 -236
-221094 -282
-254022 -354
-285389 -431
-318637 -513
-346959 -588
-371288 -663
-398215 -753
-430925 -909
-460659 -1052
-492385 -1212
-522834 -1369
-544343 -1480
-574493 -1645
-591923 -1...

output:

252099986.1016024053

result:

ok found '252099986.1016024', expected '252099986.1016024', error '0.0000000'

Test #27:

score: 30
Accepted
time: 9ms
memory: 3904kb

input:

30000
0 0
-14622 -3
-21004 -5
-52082 -23
-74883 -43
-96336 -71
-128458 -113
-156799 -154
-183046 -195
-192091 -210
-222978 -268
-242938 -309
-262594 -352
-278459 -388
-305011 -451
-334920 -535
-359764 -614
-386317 -705
-387178 -708
-403823 -768
-433061 -876
-462803 -990
-476883 -1056
-501388 -1177
-...

output:

252058372.1872791648

result:

ok found '252058372.1872792', expected '252058372.1872792', error '0.0000000'

Test #28:

score: 30
Accepted
time: 9ms
memory: 3900kb

input:

30000
0 0
-25620 -6
-58948 -27
-81188 -42
-108084 -65
-116725 -73
-125232 -81
-135235 -91
-151536 -109
-184450 -152
-207622 -186
-226702 -226
-253157 -296
-272563 -363
-285333 -416
-314647 -544
-343300 -671
-374313 -814
-396287 -921
-420576 -1040
-429098 -1083
-461737 -1259
-484471 -1384
-514561 -15...

output:

250472754.0190104544

result:

ok found '250472754.0190105', expected '250472754.0190105', error '0.0000000'

Test #29:

score: 30
Accepted
time: 9ms
memory: 3888kb

input:

30000
0 0
-33296 -14
-53478 -25
-77571 -40
-102204 -60
-131127 -87
-154300 -115
-164094 -129
-170807 -139
-182721 -162
-204059 -213
-233651 -291
-248862 -344
-272501 -427
-292422 -497
-316393 -587
-332926 -655
-357527 -758
-377377 -846
-400755 -952
-421907 -1051
-432483 -1106
-463837 -1277
-484678 -...

output:

250911365.3928250968

result:

ok found '250911365.3928251', expected '250911365.3928251', error '0.0000000'

Test #30:

score: 30
Accepted
time: 9ms
memory: 3904kb

input:

30000
0 0
-16184 -12
-47000 -41
-65809 -62
-97992 -98
-130432 -136
-141298 -155
-166593 -204
-199502 -297
-227146 -379
-253391 -469
-268774 -523
-296503 -636
-323982 -757
-356038 -900
-373220 -977
-398856 -1098
-425367 -1243
-452654 -1396
-476703 -1537
-489569 -1615
-493812 -1641
-521509 -1812
-5419...

output:

250844611.9027090669

result:

ok found '250844611.9027091', expected '250844611.9027091', error '0.0000000'

Test #31:

score: 30
Accepted
time: 9ms
memory: 3904kb

input:

30000
0 0
-25799 -4
-55851 -26
-80970 -45
-101274 -62
-132285 -92
-156585 -119
-172335 -137
-194967 -166
-207127 -182
-210322 -187
-232931 -224
-254065 -285
-276296 -355
-296092 -422
-319568 -506
-341162 -585
-366961 -682
-378425 -726
-406880 -836
-433997 -944
-462505 -1063
-484234 -1155
-510379 -12...

output:

252561817.9649026096

result:

ok found '252561817.9649026', expected '252561817.9649026', error '0.0000000'

Test #32:

score: 30
Accepted
time: 6ms
memory: 3892kb

input:

30000
0 0
-26056 -4
-54769 -14
-60303 -16
-87623 -57
-116864 -112
-138854 -159
-157862 -208
-175152 -264
-200884 -367
-230497 -499
-252728 -608
-270362 -698
-296046 -842
-305774 -898
-310136 -925
-332152 -1067
-333986 -1079
-355425 -1222
-364727 -1286
-382658 -1414
-392920 -1492
-425026 -1737
-44041...

output:

253995087.9124097824

result:

ok found '253995087.9124098', expected '253995087.9124098', error '0.0000000'

Test #33:

score: 30
Accepted
time: 9ms
memory: 3908kb

input:

30000
0 0
-9535 -2
-40752 -11
-60579 -26
-93471 -57
-118567 -94
-144069 -132
-173022 -182
-195295 -224
-223889 -296
-247193 -355
-264085 -399
-290833 -470
-296735 -486
-316658 -542
-335761 -609
-366899 -722
-382069 -779
-411737 -894
-434702 -985
-457466 -1078
-487157 -1201
-497974 -1248
-524864 -136...

output:

252472448.5275533199

result:

ok found '252472448.5275533', expected '252472448.5275533', error '0.0000000'

Test #34:

score: 30
Accepted
time: 9ms
memory: 3952kb

input:

30000
0 0
-24944 -5
-45218 -18
-63052 -30
-95222 -53
-122297 -76
-142451 -95
-166142 -128
-198625 -176
-224888 -226
-256971 -297
-268524 -323
-295294 -399
-316093 -462
-346071 -556
-357361 -596
-384063 -695
-413239 -808
-431516 -883
-455899 -988
-477258 -1083
-482936 -1109
-514885 -1259
-545203 -140...

output:

251091289.9211815596

result:

ok found '251091289.9211816', expected '251091289.9211816', error '0.0000000'

Test #35:

score: 30
Accepted
time: 6ms
memory: 3864kb

input:

30000
0 0
-30995 -2
-54625 -11
-82116 -24
-107137 -37
-118814 -46
-145376 -68
-153252 -80
-185690 -144
-216437 -215
-233722 -272
-253995 -343
-271631 -413
-292398 -507
-321561 -641
-349834 -782
-373847 -909
-394268 -1020
-413992 -1130
-437644 -1265
-455088 -1371
-479307 -1520
-487919 -1573
-510069 -...

output:

252314719.9735080898

result:

ok found '252314719.9735081', expected '252314719.9735081', error '0.0000000'

Test #36:

score: 30
Accepted
time: 9ms
memory: 3904kb

input:

30000
0 0
-27620 -15
-32869 -18
-63930 -40
-92226 -71
-117410 -103
-128286 -121
-160858 -177
-175636 -204
-202913 -255
-210245 -270
-231489 -321
-239502 -341
-270542 -438
-300109 -534
-328778 -641
-347216 -724
-378021 -873
-405203 -1017
-433216 -1174
-466343 -1375
-485498 -1495
-512206 -1683
-537113...

output:

252132224.5177777708

result:

ok found '252132224.5177778', expected '252132224.5177778', error '0.0000000'

Test #37:

score: 30
Accepted
time: 9ms
memory: 3924kb

input:

30000
0 0
-26512 -10
-51854 -27
-59926 -34
-72478 -45
-104402 -85
-134454 -126
-156279 -156
-187348 -202
-204100 -236
-236516 -302
-257885 -347
-283292 -401
-304536 -460
-329866 -533
-362401 -630
-368232 -649
-393217 -739
-412750 -810
-443034 -922
-470338 -1029
-481188 -1073
-497958 -1151
-530836 -1...

output:

251728991.7551814914

result:

ok found '251728991.7551815', expected '251728991.7551815', error '0.0000000'

Test #38:

score: 30
Accepted
time: 9ms
memory: 3992kb

input:

30000
0 0
-29212 -4
-38598 -7
-71599 -25
-95384 -48
-122534 -75
-152884 -108
-185395 -148
-193339 -166
-211296 -218
-242492 -319
-262879 -390
-280381 -452
-297193 -522
-316047 -608
-344702 -748
-362716 -837
-371851 -884
-392232 -990
-415911 -1120
-428530 -1190
-455344 -1346
-476289 -1469
-502141 -16...

output:

252836476.4363638759

result:

ok found '252836476.4363639', expected '252836476.4363639', error '0.0000000'

Test #39:

score: 30
Accepted
time: 9ms
memory: 3892kb

input:

30000
0 0
-32998 -8
-60868 -23
-90627 -40
-119903 -65
-145529 -87
-161760 -103
-169947 -115
-194965 -153
-217424 -191
-240218 -232
-262746 -278
-274663 -306
-300259 -367
-311698 -396
-338898 -472
-371940 -583
-391272 -648
-422137 -773
-450678 -889
-472143 -979
-498399 -1098
-530708 -1249
-553762 -13...

output:

254810274.4235500395

result:

ok found '254810274.4235500', expected '254810274.4235500', error '0.0000000'

Test #40:

score: 30
Accepted
time: 9ms
memory: 3888kb

input:

30000
0 0
-8940 -5
-33085 -27
-59867 -53
-86492 -79
-109768 -109
-130705 -139
-137599 -149
-167036 -193
-175992 -209
-205088 -262
-231732 -316
-253027 -361
-277001 -412
-306909 -477
-319514 -507
-337756 -557
-357495 -615
-372846 -661
-389281 -720
-409556 -800
-431984 -897
-439453 -931
-470069 -1095
...

output:

252714495.2776288390

result:

ok found '252714495.2776288', expected '252714495.2776289', error '0.0000000'

Subtask #3:

score: 60
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #41:

score: 60
Accepted
time: 137ms
memory: 11260kb

input:

500000
0 0
-1984 -1
-3948 -2
-5906 -3
-7858 -4
-9782 -5
-11687 -6
-13584 -7
-15396 -8
-17164 -9
-18920 -10
-20662 -11
-22403 -12
-24141 -13
-25841 -14
-27533 -15
-29130 -16
-30717 -17
-32294 -18
-33869 -19
-35416 -20
-36958 -21
-38470 -22
-39949 -23
-41422 -24
-42890 -25
-44343 -26
-45731 -27
-47089...

output:

250546651.9010666609

result:

ok found '250546651.9010667', expected '250546651.9010667', error '0.0000000'

Test #42:

score: 60
Accepted
time: 137ms
memory: 11008kb

input:

500000
0 0
-1966 -1
-3887 -2
-5788 -3
-7676 -4
-9407 -5
-11076 -6
-12731 -7
-14285 -8
-15829 -9
-17361 -10
-18869 -11
-20358 -12
-21841 -13
-23323 -14
-24788 -15
-26134 -16
-27457 -17
-28627 -18
-29768 -19
-30831 -20
-31881 -21
-32923 -22
-33956 -23
-34977 -24
-36961 -26
-37931 -27
-39798 -29
-40731...

output:

250435395.8838684261

result:

ok found '250435395.8838684', expected '250435395.8838684', error '0.0000000'

Test #43:

score: 60
Accepted
time: 133ms
memory: 11024kb

input:

500000
0 0
-1951 -1
-3898 -2
-5828 -3
-7755 -4
-9668 -5
-11540 -6
-13405 -7
-15238 -8
-17036 -9
-18696 -10
-20310 -11
-21918 -12
-23504 -13
-25087 -14
-26643 -15
-28191 -16
-29738 -17
-31216 -18
-32637 -19
-34040 -20
-35437 -21
-36800 -22
-38134 -23
-39411 -24
-40685 -25
-41952 -26
-43163 -27
-44372...

output:

250864379.7991594076

result:

ok found '250864379.7991594', expected '250864379.7991594', error '0.0000000'

Test #44:

score: 60
Accepted
time: 129ms
memory: 10896kb

input:

500000
0 0
-1966 -1
-3814 -2
-5658 -3
-7499 -4
-9288 -5
-10993 -6
-12683 -7
-14368 -8
-16001 -9
-17554 -10
-19098 -11
-20624 -12
-22046 -13
-23375 -14
-24684 -15
-25923 -16
-27157 -17
-28373 -18
-29570 -19
-30755 -20
-31940 -21
-33061 -22
-34101 -23
-36091 -25
-37085 -26
-39050 -28
-41010 -30
-42924...

output:

250490528.3016454279

result:

ok found '250490528.3016454', expected '250490528.3016454', error '0.0000000'

Test #45:

score: 60
Accepted
time: 138ms
memory: 11032kb

input:

500000
0 0
-2000 -1
-3991 -2
-5959 -3
-7812 -4
-9659 -5
-11486 -6
-13244 -7
-14965 -8
-16685 -9
-18403 -10
-20112 -11
-21769 -12
-23425 -13
-25049 -14
-26661 -15
-28245 -16
-29805 -17
-31321 -18
-32778 -19
-34227 -20
-35648 -21
-37063 -22
-38451 -23
-39834 -24
-41189 -25
-42537 -26
-43862 -27
-45146...

output:

250484765.8163518906

result:

ok found '250484765.8163519', expected '250484765.8163519', error '0.0000000'

Test #46:

score: 60
Accepted
time: 137ms
memory: 11268kb

input:

500000
0 0
-1999 -1
-3969 -2
-5883 -3
-7768 -4
-9646 -5
-11522 -6
-13386 -7
-15249 -8
-17083 -9
-18886 -10
-20620 -11
-22334 -12
-24010 -13
-25682 -14
-27345 -15
-28999 -16
-30653 -17
-32305 -18
-33880 -19
-35447 -20
-36987 -21
-38504 -22
-39992 -23
-41471 -24
-42894 -25
-44296 -26
-45677 -27
-47055...

output:

250230916.1903697848

result:

ok found '250230916.1903698', expected '250230916.1903698', error '0.0000000'

Test #47:

score: 60
Accepted
time: 126ms
memory: 11276kb

input:

500000
0 0
-1957 -1
-3908 -2
-5811 -3
-7704 -4
-9571 -5
-11424 -6
-13257 -7
-15084 -8
-16829 -9
-18554 -10
-20227 -11
-21839 -12
-23449 -13
-25057 -14
-26543 -15
-28022 -16
-29490 -17
-30930 -18
-32353 -19
-33776 -20
-35142 -21
-36453 -22
-37757 -23
-39042 -24
-40309 -25
-41564 -26
-42760 -27
-43906...

output:

251523690.4624040425

result:

ok found '251523690.4624040', expected '251523690.4624040', error '0.0000000'

Test #48:

score: 60
Accepted
time: 136ms
memory: 11208kb

input:

500000
0 0
-1955 -1
-3908 -2
-5832 -3
-7723 -4
-9572 -5
-11411 -6
-13149 -7
-14815 -8
-16416 -9
-18007 -10
-19594 -11
-21168 -12
-22677 -13
-24178 -14
-25679 -15
-27176 -16
-28658 -17
-30129 -18
-31590 -19
-33032 -20
-34442 -21
-35816 -22
-37044 -23
-38207 -24
-39344 -25
-40420 -26
-41421 -27
-43334...

output:

251183725.5046660304

result:

ok found '251183725.5046660', expected '251183725.5046660', error '0.0000000'

Test #49:

score: 60
Accepted
time: 133ms
memory: 11088kb

input:

500000
0 0
-1997 -1
-3931 -2
-5858 -3
-7761 -4
-9578 -5
-11389 -6
-13134 -7
-14876 -8
-16612 -9
-18328 -10
-19994 -11
-21530 -12
-23041 -13
-24493 -14
-25929 -15
-27352 -16
-28721 -17
-30062 -18
-31354 -19
-32639 -20
-33919 -21
-35198 -22
-36458 -23
-37669 -24
-38874 -25
-40072 -26
-41248 -27
-42388...

output:

250578576.6313597560

result:

ok found '250578576.6313598', expected '250578576.6313598', error '0.0000000'

Test #50:

score: 60
Accepted
time: 133ms
memory: 11268kb

input:

500000
0 0
-1945 -1
-3846 -2
-5639 -3
-7414 -4
-9185 -5
-10917 -6
-12609 -7
-14296 -8
-15973 -9
-17613 -10
-19227 -11
-20729 -12
-22204 -13
-23675 -14
-25145 -15
-26563 -16
-27980 -17
-29273 -18
-30544 -19
-31789 -20
-33034 -21
-34257 -22
-35442 -23
-36592 -24
-37740 -25
-38877 -26
-39955 -27
-41029...

output:

250877196.0392704904

result:

ok found '250877196.0392705', expected '250877196.0392705', error '0.0000000'

Extra Test:

score: -3
Extra Test Failed : Wrong Answer on 6
time: 0ms
memory: 3960kb

input:

7
-170000000 -180000000
-60000000 -170000000
50000000 -160000000
160000000 -150000000
170000000 90000000
110000000 200000000
-140000000 190000000

output:

453431361.9501853585

result:

wrong answer 1st numbers differ - expected: '472016948.8482379', found: '453431361.9501854', error = '0.0393748'