QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#726737#9547. Two Convex HolesTheZoneAC ✓625ms12512kbC++2016.8kb2024-11-09 07:54:272024-11-09 07:54:29

Judging History

This is the latest submission verdict.

  • [2024-11-09 07:54:29]
  • Judged
  • Verdict: AC
  • Time: 625ms
  • Memory: 12512kb
  • [2024-11-09 07:54:27]
  • Submitted

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long double db;
const db inf=1e100;
const db eps=1e-10;
const db pi=acos(db(-1));
int sgn(db x)
{
    if(x>eps)return 1;
    if(x<-eps)return -1;
    return 0;
}
struct Point
{
    db x,y;
    Point() {}
    Point(db _x,db _y):x(_x),y(_y) {}
    Point operator + (const Point& t)const
    {
        return Point(x+t.x,y+t.y);
    }
    Point operator - (const Point& t)const
    {
        return Point(x-t.x,y-t.y);
    }
    Point operator * (const db& t)const
    {
        return Point(x*t,y*t);
    }
    Point operator / (const db& t)const
    {
        return Point(x/t,y/t);
    }
    db operator * (const Point& t)const
    {
        return x*t.y-y*t.x;
    }
    db operator ^ (const Point& t)const
    {
        return x*t.x+y*t.y;
    }
    db len()const
    {
        return sqrt(x*x+y*y);
    }
    Point norm()const
    {
        return *this/len();
    }
    Point rot90()const
    {
        return Point(-y,x);
    }
    Point rot(db tx,db ty)const
    {
        db r=sqrt(tx*tx+ty*ty),c=tx/r,s=ty/r;
        return Point(x*c-y*s,x*s+y*c);
    }
    bool operator < (const Point &t)const
    {
        return sgn(x-t.x)==0 ? y<t.y : x<t.x;
    }
    void read()
    {
        int tx,ty;
        scanf("%d%d",&tx,&ty);
        x=tx,y=ty;
    }
};
struct Line
{
    Point s,v;
    Line() {}
    Line(const Point& _s,const Point& _v):s(_s),v(_v.norm()) {}
    bool left(const Point& p)const
    {
        return sgn((p-s)*v)<0;
    }
    pair<bool,Point> operator & (const Line &t)const
    {
        db c=v*t.v;
        if(sgn(c)==0)return make_pair(0,Point());
        return make_pair(1,s+v*(((t.s-s)*t.v)/c));
    }
};
pair<vector<Point>,vector<Line>> halfplane_intersect(vector<Line> lines)
{
    sort(lines.begin(),lines.end(),[&](const Line& lhs,const Line& rhs)
    {
        bool up[2]= {lhs.v.y>0 || (lhs.v.y==0 && lhs.v.x>0),
                     rhs.v.y>0 || (rhs.v.y==0 && rhs.v.x>0)
                    };
        if(up[0]^up[1])return up[0];
        return lhs.v*rhs.v>0;
    });
    vector<Point> p(lines.size());
    vector<Line> hp(lines.size());
    hp[0]=lines[0];
    int h=0,t=0;
    for(size_t i=1; i<lines.size(); i++)
    {
        while(h<t && !lines[i].left(p[t-1]))t--;
        while(h<t && !lines[i].left(p[h]))h++;
        if(sgn(lines[i].v*hp[t].v)!=0)hp[++t]=lines[i];
        else if(!lines[i].left(hp[t].s))hp[t]=lines[i];
        if(h<t)p[t-1]=(hp[t]&hp[t-1]).second;
    }
    while(h<t && !hp[h].left(p[t-1]))t--;
    if(t-h<2)return {};
    p[t]=(hp[t]&hp[h]).second;
    db area=0;
    for(int i=0; i<=t-h; i++)
        area+=p[i+h]*p[(i+1)%(t-h+1)+h];
    if(sgn(area)<=0)return {};
    return {vector<Point>(p.begin()+h,p.begin()+t+1),
            vector<Line>(hp.begin()+h,hp.begin()+t+1)};
}
db area(const vector<Point>& p)
{
    if(p.size()<3)return 0;
    db res=0;
    for(size_t i=1; i+1<p.size(); i++)
        res+=(p[i]-p[0])*(p[i+1]-p[0])/2;
    return res;
}
vector<Point> convex_hull(vector<Point> pts,bool upper)
{
    if(upper)for(auto& p : pts)p.y*=-1;
    sort(pts.begin(),pts.end());
    vector<Point> stk;
    int top=0;
    for(size_t i=0; i<pts.size(); i++)
    {
        if(i>0 && sgn(pts[i].x-pts[i-1].x)==0)continue;
        while(top>1 && sgn((pts[i]-stk[top-1])*(stk[top-1]-stk[top-2]))>=0)
            stk.pop_back(),--top;
        stk.push_back(pts[i]),++top;
    }
    if(upper)for(auto& p : stk)p.y*=-1;
    return stk;
}
bool get_hull_y(const vector<Point>& hull,db x,db& y)
{
    auto itr=lower_bound(hull.begin(),hull.end(),Point(x-eps,-inf));
    if(itr==hull.end())return 0;
    if(itr==hull.begin())
    {
        if(sgn(x - itr->x)<0)return 0;
        y = itr->y;
        return 1;
    }
    auto pre=prev(itr);
    y=(x - pre->x)*((itr->y - pre->y)/(itr->x - pre->x)) + pre->y;
    return 1;
}
struct Slice
{
    db l,r,ld[2],lu[2],rd[2],ru[2];
    db cal(db t)
    {
        vector<Line> line;
        line.emplace_back(Point(l,0),Point(0,-1));
        line.emplace_back(Point(r,0),Point(0,1));
        for(int i=0; i<2; i++)
        {
            line.emplace_back(Point(l,ld[i]+(i==0)*t),Point(r-l,rd[i]-ld[i]));
            line.emplace_back(Point(r,ru[i]+(i==0)*t),Point(l-r,lu[i]-ru[i]));
        }
        return area(halfplane_intersect(move(line)).first);
    }
};
struct AreaFunc
{
    db l,r,a,b,c; // at^2+bt+c (l<=t<=r)
};
int solve()
{
    // input
    Point po,pv;
    int z0,z1,z2,n1,n2;
    po.read();
    scanf("%d",&z0);
    pv.read();
    scanf("%d%d",&n1,&z1);
    vector<Point> p1(n1);
    for(int i=0; i<n1; i++)
        p1[i].read();
    scanf("%d%d",&n2,&z2);
    vector<Point> p2(n2);
    for(int i=0; i<n2; i++)
        p2[i].read();

    // normalize
    db rat=1.0L*(z0-z2)/(z0-z1);
    for(int i=0; i<n1; i++)
        p1[i]=p1[i]*rat+po*(1-rat);
    for(int i=0; i<n1; i++)
        p1[i]=p1[i].rot(pv.x,-pv.y).rot90();
    for(int i=0; i<n2; i++)
        p2[i]=p2[i].rot(pv.x,-pv.y).rot90();
    rat=1.0L*z0/(z0-z2);
    db v=pv.len()*(z2-z1)/(z0-z1);

    // slice
    auto d1=convex_hull(p1,0);
    auto u1=convex_hull(p1,1);
    auto d2=convex_hull(p2,0);
    auto u2=convex_hull(p2,1);
    vector<db> all_x;
    for(int i=0; i<n1; i++)
        all_x.push_back(p1[i].x);
    for(int i=0; i<n2; i++)
        all_x.push_back(p2[i].x);
    sort(all_x.begin(),all_x.end());
    all_x.erase(unique(all_x.begin(),all_x.end()),all_x.end());
    vector<Slice> slice;
    for(size_t i=0; i+1<all_x.size(); i++)
    {
        if(sgn(all_x[i]-all_x[i+1])==0)continue;
        Slice s;
        s.l=all_x[i],s.r=all_x[i+1];
        if(!get_hull_y(d1,s.l,s.ld[0]))continue;
        if(!get_hull_y(u1,s.l,s.lu[0]))continue;
        if(!get_hull_y(d1,s.r,s.rd[0]))continue;
        if(!get_hull_y(u1,s.r,s.ru[0]))continue;
        if(!get_hull_y(d2,s.l,s.ld[1]))continue;
        if(!get_hull_y(u2,s.l,s.lu[1]))continue;
        if(!get_hull_y(d2,s.r,s.rd[1]))continue;
        if(!get_hull_y(u2,s.r,s.ru[1]))continue;
        slice.push_back(move(s));
    }

    // get area_func
    vector<AreaFunc> func;
    for(auto& s : slice)
    {
        vector<db> event;
        event.push_back(s.ld[1]-s.ld[0]);
        event.push_back(s.lu[1]-s.ld[0]);
        event.push_back(s.ld[1]-s.lu[0]);
        event.push_back(s.lu[1]-s.lu[0]);
        event.push_back(s.rd[1]-s.rd[0]);
        event.push_back(s.ru[1]-s.rd[0]);
        event.push_back(s.rd[1]-s.ru[0]);
        event.push_back(s.ru[1]-s.ru[0]);
        for(auto& e : event)e/=v;
        sort(event.begin(),event.end());
        event.erase(unique(event.begin(),event.end()),event.end());
        vector<db> area(event.size()*2-1);
        for(size_t i=0; i<event.size(); i++)
        {
            area[2*i]=s.cal(event[i]*v);
            if(i+1<event.size())
                area[2*i+1]=s.cal((event[i]+event[i+1])/2*v);
        }
        for(size_t i=0; i+1<event.size(); i++)
        {
            db xl=event[i],yl=area[2*i];
            db xm=(event[i]+event[i+1])/2,ym=area[2*i+1];
            db xr=event[i+1],yr=area[2*i+2];
            AreaFunc f;
            f.l=xl,f.r=xr;
            if(sgn(xr-xl)<=0)
            {
                f.a=0;
                f.b=(yr-yl)/(xr-xl);
                f.c=ym-f.b*xm;
            }
            else
            {
                f.a=2*(yl+yr-2*ym)/((xr-xl)*(xr-xl));
                f.b=(yr-yl)/(xr-xl)-f.a*(xl+xr);
                f.c=ym-f.a*xm*xm-f.b*xm;
            }
            func.push_back(move(f));
        }
    }

    // agg area func
    all_x.clear();
    for(auto& f : func)
    {
        all_x.push_back(f.l);
        all_x.push_back(f.r);
    }
    sort(all_x.begin(),all_x.end());
    all_x.erase(unique(all_x.begin(),all_x.end()),all_x.end());
    vector<array<db,3>> area(all_x.size());
    for(auto& f : func)
    {
        size_t i=lower_bound(all_x.begin(),all_x.end(),f.l)-all_x.begin();
        area[i][0]+=f.a,area[i][1]+=f.b,area[i][2]+=f.c;
        i=lower_bound(all_x.begin(),all_x.end(),f.r)-all_x.begin();
        area[i][0]-=f.a,area[i][1]-=f.b,area[i][2]-=f.c;
    }
    for(size_t i=1; i<area.size(); i++)
        for(int j=0; j<3; j++)
            area[i][j]+=area[i-1][j];

    // query
    auto get=[&](const array<db,3>& f,db t)
    {
        return f[0]*t*t+f[1]*t+f[2];
    };
    auto get_val=[&](db t)
    {
        auto itr=lower_bound(all_x.begin(),all_x.end(),t-eps);
        if(itr==all_x.begin() || itr==all_x.end())return db(0);
        return get(area[itr-all_x.begin()-1],t);
    };
    auto get_intgr=[&](const array<db,3>& f,db l,db r)
    {
        return (f[0]*r*r*r/3+f[1]*r*r/2+f[2]*r)-(f[0]*l*l*l/3+f[1]*l*l/2+f[2]*l);
    };
    vector<db> pre_sum(all_x.size());
    for(size_t i=1; i<all_x.size(); i++)
        pre_sum[i]=pre_sum[i-1]+get_intgr(area[i-1],all_x[i-1],all_x[i]);
    auto get_sum=[&](db t)
    {
        auto itr=lower_bound(all_x.begin(),all_x.end(),t-eps);
        if(itr==all_x.begin())return db(0);
        if(itr==all_x.end())return pre_sum[all_x.size()-1];
        int i=itr-all_x.begin()-1;
        return pre_sum[i]+get_intgr(area[i],all_x[i],t);
    };
    int q;
    scanf("%d",&q);
    while(q--)
    {
        int t1,t2;
        scanf("%d%d",&t1,&t2);
        db res;
        if(t1==t2)res=get_val(t1);
        else res=(get_sum(t2)-get_sum(t1))/(t2-t1);
        printf("%.12Lf\n",res*rat*rat);
    }
    return 0;
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long double db;
const db inf=1e100;
const db eps=1e-10;
const db pi=acos(db(-1));
int sgn(db x)
{
    if(x>eps)return 1;
    if(x<-eps)return -1;
    return 0;
}
struct Point
{
    db x,y;
    Point() {}
    Point(db _x,db _y):x(_x),y(_y) {}
    Point operator + (const Point& t)const
    {
        return Point(x+t.x,y+t.y);
    }
    Point operator - (const Point& t)const
    {
        return Point(x-t.x,y-t.y);
    }
    Point operator * (const db& t)const
    {
        return Point(x*t,y*t);
    }
    Point operator / (const db& t)const
    {
        return Point(x/t,y/t);
    }
    db operator * (const Point& t)const
    {
        return x*t.y-y*t.x;
    }
    db operator ^ (const Point& t)const
    {
        return x*t.x+y*t.y;
    }
    db len()const
    {
        return sqrt(x*x+y*y);
    }
    Point norm()const
    {
        return *this/len();
    }
    Point rot90()const
    {
        return Point(-y,x);
    }
    Point rot(db tx,db ty)const
    {
        db r=sqrt(tx*tx+ty*ty),c=tx/r,s=ty/r;
        return Point(x*c-y*s,x*s+y*c);
    }
    bool operator < (const Point &t)const
    {
        return sgn(x-t.x)==0 ? y<t.y : x<t.x;
    }
    void read()
    {
        int tx,ty;
        scanf("%d%d",&tx,&ty);
        x=tx,y=ty;
    }
};
struct Line
{
    Point s,v;
    Line() {}
    Line(const Point& _s,const Point& _v):s(_s),v(_v.norm()) {}
    bool left(const Point& p)const
    {
        return sgn((p-s)*v)<0;
    }
    pair<bool,Point> operator & (const Line &t)const
    {
        db c=v*t.v;
        if(sgn(c)==0)return make_pair(0,Point());
        return make_pair(1,s+v*(((t.s-s)*t.v)/c));
    }
};
pair<vector<Point>,vector<Line>> halfplane_intersect(vector<Line> lines)
{
    sort(lines.begin(),lines.end(),[&](const Line& lhs,const Line& rhs)
    {
        bool up[2]= {lhs.v.y>0 || (lhs.v.y==0 && lhs.v.x>0),
                     rhs.v.y>0 || (rhs.v.y==0 && rhs.v.x>0)
                    };
        if(up[0]^up[1])return up[0];
        return lhs.v*rhs.v>0;
    });
    vector<Point> p(lines.size());
    vector<Line> hp(lines.size());
    hp[0]=lines[0];
    int h=0,t=0;
    for(size_t i=1; i<lines.size(); i++)
    {
        while(h<t && !lines[i].left(p[t-1]))t--;
        while(h<t && !lines[i].left(p[h]))h++;
        if(sgn(lines[i].v*hp[t].v)!=0)hp[++t]=lines[i];
        else if(!lines[i].left(hp[t].s))hp[t]=lines[i];
        if(h<t)p[t-1]=(hp[t]&hp[t-1]).second;
    }
    while(h<t && !hp[h].left(p[t-1]))t--;
    if(t-h<2)return {};
    p[t]=(hp[t]&hp[h]).second;
    db area=0;
    for(int i=0; i<=t-h; i++)
        area+=p[i+h]*p[(i+1)%(t-h+1)+h];
    if(sgn(area)<=0)return {};
    return {vector<Point>(p.begin()+h,p.begin()+t+1),
            vector<Line>(hp.begin()+h,hp.begin()+t+1)};
}
db area(const vector<Point>& p)
{
    if(p.size()<3)return 0;
    db res=0;
    for(size_t i=1; i+1<p.size(); i++)
        res+=(p[i]-p[0])*(p[i+1]-p[0])/2;
    return res;
}
vector<Point> convex_hull(vector<Point> pts,bool upper)
{
    if(upper)for(auto& p : pts)p.y*=-1;
    sort(pts.begin(),pts.end());
    vector<Point> stk;
    int top=0;
    for(size_t i=0; i<pts.size(); i++)
    {
        if(i>0 && sgn(pts[i].x-pts[i-1].x)==0)continue;
        while(top>1 && sgn((pts[i]-stk[top-1])*(stk[top-1]-stk[top-2]))>=0)
            stk.pop_back(),--top;
        stk.push_back(pts[i]),++top;
    }
    if(upper)for(auto& p : stk)p.y*=-1;
    return stk;
}
bool get_hull_y(const vector<Point>& hull,db x,db& y)
{
    auto itr=lower_bound(hull.begin(),hull.end(),Point(x-eps,-inf));
    if(itr==hull.end())return 0;
    if(itr==hull.begin())
    {
        if(sgn(x - itr->x)<0)return 0;
        y = itr->y;
        return 1;
    }
    auto pre=prev(itr);
    y=(x - pre->x)*((itr->y - pre->y)/(itr->x - pre->x)) + pre->y;
    return 1;
}
struct Slice
{
    db l,r,ld[2],lu[2],rd[2],ru[2];
    db cal(db t)
    {
        vector<Line> line;
        line.emplace_back(Point(l,0),Point(0,-1));
        line.emplace_back(Point(r,0),Point(0,1));
        for(int i=0; i<2; i++)
        {
            line.emplace_back(Point(l,ld[i]+(i==0)*t),Point(r-l,rd[i]-ld[i]));
            line.emplace_back(Point(r,ru[i]+(i==0)*t),Point(l-r,lu[i]-ru[i]));
        }
        return area(halfplane_intersect(move(line)).first);
    }
};
struct AreaFunc
{
    db l,r,a,b,c; // at^2+bt+c (l<=t<=r)
};
int solve()
{
    // input
    Point po,pv;
    int z0,z1,z2,n1,n2;
    po.read();
    scanf("%d",&z0);
    pv.read();
    scanf("%d%d",&n1,&z1);
    vector<Point> p1(n1);
    for(int i=0; i<n1; i++)
        p1[i].read();
    scanf("%d%d",&n2,&z2);
    vector<Point> p2(n2);
    for(int i=0; i<n2; i++)
        p2[i].read();

    // normalize
    db rat=1.0L*(z0-z2)/(z0-z1);
    for(int i=0; i<n1; i++)
        p1[i]=p1[i]*rat+po*(1-rat);
    for(int i=0; i<n1; i++)
        p1[i]=p1[i].rot(pv.x,-pv.y).rot90();
    for(int i=0; i<n2; i++)
        p2[i]=p2[i].rot(pv.x,-pv.y).rot90();
    rat=1.0L*z0/(z0-z2);
    db v=pv.len()*(z2-z1)/(z0-z1);

    // slice
    auto d1=convex_hull(p1,0);
    auto u1=convex_hull(p1,1);
    auto d2=convex_hull(p2,0);
    auto u2=convex_hull(p2,1);
    vector<db> all_x;
    for(int i=0; i<n1; i++)
        all_x.push_back(p1[i].x);
    for(int i=0; i<n2; i++)
        all_x.push_back(p2[i].x);
    sort(all_x.begin(),all_x.end());
    all_x.erase(unique(all_x.begin(),all_x.end()),all_x.end());
    vector<Slice> slice;
    for(size_t i=0; i+1<all_x.size(); i++)
    {
        if(sgn(all_x[i]-all_x[i+1])==0)continue;
        Slice s;
        s.l=all_x[i],s.r=all_x[i+1];
        if(!get_hull_y(d1,s.l,s.ld[0]))continue;
        if(!get_hull_y(u1,s.l,s.lu[0]))continue;
        if(!get_hull_y(d1,s.r,s.rd[0]))continue;
        if(!get_hull_y(u1,s.r,s.ru[0]))continue;
        if(!get_hull_y(d2,s.l,s.ld[1]))continue;
        if(!get_hull_y(u2,s.l,s.lu[1]))continue;
        if(!get_hull_y(d2,s.r,s.rd[1]))continue;
        if(!get_hull_y(u2,s.r,s.ru[1]))continue;
        slice.push_back(move(s));
    }

    // get area_func
    vector<AreaFunc> func;
    for(auto& s : slice)
    {
        vector<db> event;
        event.push_back(s.ld[1]-s.ld[0]);
        event.push_back(s.lu[1]-s.ld[0]);
        event.push_back(s.ld[1]-s.lu[0]);
        event.push_back(s.lu[1]-s.lu[0]);
        event.push_back(s.rd[1]-s.rd[0]);
        event.push_back(s.ru[1]-s.rd[0]);
        event.push_back(s.rd[1]-s.ru[0]);
        event.push_back(s.ru[1]-s.ru[0]);
        for(auto& e : event)e/=v;
        sort(event.begin(),event.end());
        event.erase(unique(event.begin(),event.end()),event.end());
        vector<db> area(event.size()*2-1);
        for(size_t i=0; i<event.size(); i++)
        {
            area[2*i]=s.cal(event[i]*v);
            if(i+1<event.size())
                area[2*i+1]=s.cal((event[i]+event[i+1])/2*v);
        }
        for(size_t i=0; i+1<event.size(); i++)
{
    int T;
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}
*/

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4108kb

input:

1
0 0 3 0 -1
4 1
1 0
3 0
3 2
1 2
4 2
0 0
1 0
1 1
0 1
3
0 10
1 2
1 1

output:

0.450000000000
1.125000000000
2.250000000000

result:

ok 3 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

1
-5448 2169 9 731 -431
64 1
-7417 -2691
-7203 -4235
-6869 -6172
-6746 -6856
-6628 -7104
-5983 -7731
-5755 -7926
-4211 -8457
-3739 -8585
-3653 -8604
-2307 -8877
-998 -9109
-201 -9110
874 -9110
2692 -8754
2984 -8696
3438 -8597
3671 -8536
5152 -8058
5700 -7775
5892 -7619
6304 -7221
7388 -5673
7742 -51...

output:

910.017689578974

result:

ok found '910.01769', expected '910.01769', error '0.00000'

Test #3:

score: 0
Accepted
time: 321ms
memory: 3868kb

input:

10000
-8 -1 6 -1 -5
3 1
-7 7
-6 -3
3 6
3 4
-7 3
10 -2
-7 4
5
5 7
1 1
0 0
0 5
1 8
-10 -4 10 -8 7
5 4
-9 1
-8 -7
4 -9
5 7
3 9
5 8
-8 4
2 -10
4 -8
10 1
8 9
7
3 9
1 3
7 9
6 10
3 9
0 1
3 3
-2 9 9 4 -3
3 4
-10 10
-6 -7
8 -5
3 5
-9 1
-2 -2
7 1
3
6 7
2 7
4 5
-10 4 7 -2 5
3 3
-10 7
-8 -9
-3 10
3 4
-9 9
2 -9
...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
52.818304812834
70.185469186009
71.046293332286
0.000000000000
0.000000000000
0.004375828232
7.275904350836
2.2404240550...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 319ms
memory: 3976kb

input:

10000
7 2 9 -3 10
5 1
-10 8
-7 4
-4 1
0 -2
10 3
3 6
-10 10
-8 -4
7 -10
4
0 8
3 3
1 1
0 1
-9 3 10 -5 -3
3 3
-10 -7
3 -2
7 10
3 6
-9 1
-7 8
-8 10
2
5 9
6 7
-6 -8 9 -3 9
3 6
-1 -8
3 -10
3 -5
4 8
-9 -3
7 -6
9 6
-8 9
3
3 7
2 9
1 4
3 4 7 9 -6
4 1
-10 9
4 -10
7 -10
8 10
4 2
-10 1
2 -5
4 -3
3 4
4
6 6
2 7
6 ...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
4.952380952381
41.555555555556
7.480112074598
25.505280691829
7.480112074598
8.805512843981
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.002425406093
2.947676565120
0.00000000000...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 319ms
memory: 3860kb

input:

10000
-7 8 9 6 10
5 2
-7 -1
-4 -7
3 -3
6 6
-7 5
4 8
-9 0
-4 -10
3 4
-4 4
6
3 8
5 7
7 8
8 10
0 5
6 6
7 -5 9 -3 -2
4 4
-3 3
8 -5
8 -4
7 7
4 7
-9 3
-6 -2
10 2
2 5
4
5 10
2 5
6 7
1 8
9 -7 9 8 -5
3 2
-7 7
-6 -1
1 5
5 4
-5 -9
5 -10
8 2
2 5
-3 3
9
5 6
8 9
0 2
4 6
0 0
3 3
4 7
2 3
2 7
-2 -7 7 -5 3
3 1
1 10
2...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
51.202564197669
0.000305514098
51.244897959184
27.543447560843
0.000203676065
41.400579504529
10.312079671181
0.00000000...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 320ms
memory: 4140kb

input:

10000
3 7 10 -7 -3
5 2
-1 1
6 -7
8 -2
4 4
-1 6
3 8
-6 -3
-2 -7
-2 9
1
1 7
-2 -5 7 -5 5
3 1
-9 1
10 -7
8 9
3 6
-2 4
5 -6
6 10
5
2 10
5 7
4 10
1 2
1 5
-2 0 10 1 5
3 1
-4 10
7 3
3 6
3 2
-9 4
-4 -9
-6 0
2
3 4
3 10
2 4 10 -3 -6
3 1
-7 5
-5 -7
10 -3
5 7
-9 -6
-7 -9
2 -9
5 -7
0 -3
10
2 10
6 7
0 1
1 5
5 5
6...

output:

5.784346917779
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
11.190714765650
0.000000000000
0.000747423587
38.311156252625
0.000000000000
0.000000000000
0.000000000000
87.508230746158
21.892089287214
110.016006592814
11.630007558579
23.80839...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 318ms
memory: 3924kb

input:

10000
-7 -9 8 -2 -9
4 5
-8 -7
4 -9
5 8
-8 4
4 7
-7 2
0 -5
6 6
-6 9
3
8 10
4 6
2 5
-3 -2 10 10 -8
3 6
-9 0
-7 -6
4 7
5 9
-10 4
-6 -8
2 -8
-2 3
-8 4
2
2 5
6 10
-8 -7 9 2 5
4 2
-10 -4
9 -2
7 5
2 10
5 3
-8 6
-5 -9
9 -5
4 7
-4 7
1
8 8
-7 -7 10 7 7
4 5
-10 -8
6 -4
6 3
-2 8
4 8
-9 -9
8 8
6 8
-4 4
8
3 8
3 8...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
108.992835208756
5.565255731922
5.565255731922
49.864359023357
0.000000000000
142.986144592982
0.000000000000
79.072373021091
62.330448779196
17.976006760729
0.000000000000
36.318736958644
0.000000000000
0.000000000000
0.0000...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 317ms
memory: 3876kb

input:

10000
7 -5 9 2 10
3 1
-2 2
9 -2
10 2
3 6
-10 -5
5 6
-5 10
1
5 5
-9 3 8 -9 -7
4 3
-10 -4
9 1
4 5
-8 8
3 7
-7 -2
9 -2
7 8
12
5 7
7 8
0 0
2 5
3 5
5 10
3 4
3 8
1 7
5 8
2 9
3 10
-5 0 9 -3 -8
5 4
-10 -2
3 -8
9 5
6 9
-5 8
4 8
-10 -3
6 -3
10 2
7 10
8
1 6
4 6
8 8
1 5
4 7
7 8
2 9
4 8
-10 -4 9 6 -5
5 5
3 -1
9 ...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 316ms
memory: 3956kb

input:

10000
-8 -5 4 -1 5
3 1
-3 -8
0 -5
2 5
4 2
-5 -5
9 7
9 10
-2 8
10
1 6
4 5
3 10
1 6
1 2
1 3
0 4
9 9
6 8
1 3
8 3 5 8 2
5 1
-7 -8
3 -7
-1 -2
-5 1
-7 -7
4 4
-4 -3
-1 -7
7 -8
-1 7
12
3 7
8 8
9 10
4 5
6 8
1 8
0 5
2 9
5 8
5 5
0 0
2 7
-1 8 10 -9 -7
6 1
-3 -6
1 -8
6 -7
6 -5
0 6
-2 5
4 5
-7 8
-6 -7
5 -3
2 9
9
...

output:

6.129860401198
0.000000000000
0.025925925926
6.129860401198
19.980600337291
15.233910262255
11.080578123821
0.000000000000
0.000000000000
15.233910262255
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 317ms
memory: 3980kb

input:

10000
-2 -5 7 -3 6
3 2
-3 -7
9 -8
1 -7
5 5
-9 -10
6 -3
8 -1
-4 7
-5 4
4
1 5
6 10
8 10
0 4
6 -5 10 9 -3
6 4
-6 -8
1 -10
7 -6
3 4
-4 10
-6 -2
4 9
-7 -6
-2 -8
2 -8
10 6
8
4 7
2 10
0 1
2 2
2 8
3 9
0 3
0 5
-7 -5 9 8 7
3 4
-8 6
-2 4
6 3
4 5
-10 -9
-5 -8
-1 0
-6 -3
17
0 9
6 10
1 10
6 6
0 5
10 10
8 9
3 4
0 ...

output:

1.637413916947
0.000000000000
0.000000000000
2.565722122720
0.000000000000
0.000000000000
1.876813800101
0.000000000000
0.000000000000
0.000000000000
0.625604600034
0.375362760020
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 317ms
memory: 3920kb

input:

10000
-7 -8 9 -1 5
5 6
-5 10
1 -5
9 -10
10 -1
-2 10
3 7
-8 -9
5 -7
-8 -1
5
2 5
0 2
8 10
6 8
0 4
-6 -3 10 1 -5
3 7
-10 -6
7 8
-1 7
4 8
-8 8
-4 6
8 6
2 7
1
8 8
1 -6 8 2 -4
3 1
-9 -9
7 -1
-6 7
4 2
-10 10
-5 6
4 1
8 1
6
7 9
3 6
9 9
2 10
8 10
1 2
0 -8 10 -10 -3
4 4
-4 -10
7 7
8 9
6 10
3 9
-8 0
8 -3
4 6
1...

output:

0.000000000000
108.521935069233
0.000000000000
0.000000000000
54.260967534616
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
220.20000000...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 319ms
memory: 3860kb

input:

10000
-5 3 9 -4 -1
3 2
-1 2
8 -3
0 10
3 8
-5 -5
10 -8
6 5
8
0 1
4 10
8 9
5 10
5 10
4 4
0 1
0 7
1 2 6 8 6
3 2
-9 -9
-3 -7
-4 10
4 5
-9 9
-5 1
-1 -5
6 9
2
3 9
1 5
-2 0 9 8 0
4 2
-5 -10
8 -9
9 3
-2 9
5 8
-10 1
-9 -3
7 -7
2 3
1 3
13
4 6
6 8
3 10
4 6
1 2
4 5
6 10
2 6
1 3
4 9
2 3
0 9
8 8
-10 -8 8 -2 -10
4...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 369ms
memory: 4192kb

input:

3000
78 -37 984 -936 -370
9 158
-911 94
-338 -910
-20 -938
746 -972
922 -628
988 107
951 719
-94 936
-815 876
7 717
-960 -107
-231 -851
-112 -963
136 -970
979 99
565 655
-821 120
66
61 89
53 73
5 67
100 100
60 60
22 74
40 68
29 95
81 89
73 75
2 65
3 70
41 64
13 61
38 52
74 82
72 85
89 92
62 77
28 39...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 369ms
memory: 4024kb

input:

3000
-67 75 588 514 -204
9 202
-942 678
-809 -376
-438 -910
-301 -967
827 -834
993 -83
1000 216
976 793
323 776
12 457
-982 -27
-923 -331
-851 -666
-297 -900
60 -944
884 -419
910 -275
751 478
182 984
-633 830
-863 783
-962 653
5
17 52
37 38
89 89
51 97
56 93
62 -58 758 475 38
6 695
-865 872
-439 -45...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
13671.177245005518
0.000000000000
0.000000000000
23746.177186734271
0.00000...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 373ms
memory: 4012kb

input:

3000
-58 -85 960 -15 286
12 387
-964 109
-899 -184
-109 -853
72 -904
953 -741
970 -497
991 397
857 779
830 852
699 968
-755 985
-959 527
8 596
-983 -850
-294 -923
842 -841
989 -207
976 635
724 935
-551 949
-980 927
6
36 66
77 87
29 51
55 99
70 89
79 89
-99 -7 795 556 995
6 442
-835 229
-752 -635
-24...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
1029799.360286796309
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.0000000...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 373ms
memory: 4160kb

input:

3000
75 84 988 574 -757
10 504
-967 -610
-882 -924
724 -893
793 -867
873 -595
985 -35
633 490
175 865
-851 935
-965 -353
7 765
-803 -198
-404 -915
221 -987
820 -755
933 359
809 908
-543 329
26
74 91
29 71
10 80
34 37
77 89
0 21
59 86
25 65
79 98
16 56
21 34
12 55
6 26
67 73
30 66
29 40
3 78
13 57
21...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
1196864.381433100973
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
192.186895201720
0.000000000000
0.000000000000
0.00000...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 373ms
memory: 4200kb

input:

3000
-26 86 643 337 -777
8 449
-891 24
-831 -802
735 -975
879 -627
978 385
998 761
-523 930
-827 579
7 563
-791 -579
220 -766
484 -747
770 -607
942 456
929 959
-599 941
63
26 47
1 34
66 72
1 23
19 91
34 73
7 48
15 60
25 69
10 99
6 93
37 92
32 46
26 94
58 64
21 21
5 29
21 80
48 94
24 99
12 31
17 88
3...

output:

0.000000000000
716454.458509882377
0.000000000000
1074681.687764823565
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.00...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 371ms
memory: 3920kb

input:

3000
-62 -78 898 -314 288
6 168
-995 624
164 -897
849 -726
889 899
-14 886
-679 826
5 850
-891 -849
-707 -830
867 -141
665 881
-850 715
35
10 52
23 56
61 95
63 96
41 58
29 72
23 28
7 92
24 40
15 62
85 89
1 59
20 20
63 71
10 37
29 48
12 67
2 2
53 53
7 81
15 75
6 76
16 63
6 32
14 76
13 74
22 87
2 17
3...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
104457.292068430267
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
3502974.940803152647
0.000000000000
0.00...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 370ms
memory: 3920kb

input:

3000
-1 40 801 18 45
10 245
-920 431
-743 -781
-403 -926
769 -887
960 -462
893 970
775 994
-132 970
-873 903
-904 853
10 690
-935 -206
-834 -359
164 -980
432 -915
865 -780
894 -669
1000 746
-36 778
-474 529
-908 -115
27
49 67
1 90
9 89
15 39
14 43
62 75
89 94
7 72
11 83
17 99
50 87
63 86
46 71
12 20...

output:

0.000000000000
1457170.011103476171
942960.620254317463
1447882.600594990638
1432062.026394152005
0.000000000000
0.000000000000
1369225.691727867578
859361.517755269465
272620.839251770394
0.000000000000
0.000000000000
0.000000000000
5773545.110326598123
1569260.954678964644
111531.970936752641
6765...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 373ms
memory: 3968kb

input:

3000
-37 -8 747 354 -861
11 228
-956 540
-880 -451
-824 -979
-113 -982
950 -978
907 371
799 750
728 914
69 940
-460 928
-824 844
10 255
-966 747
-897 -782
-817 -850
-662 -890
237 -977
936 -756
965 -624
999 115
741 762
-45 809
52
11 54
77 77
43 95
18 42
62 90
0 39
1 91
9 34
6 31
8 47
51 84
17 46
38 8...

output:

1422077.663308758855
0.000000000000
0.000000000000
1358469.757807747705
0.000000000000
3228392.675512018330
1325934.428891451278
2777045.033058228276
3338493.550174865923
1961814.792342598334
0.000000000000
1243685.584823513592
3810.021835834150
1528168.337685032240
0.000000000000
390535.81036917249...

result:

ok 100000 numbers

Test #21:

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

input:

3000
48 -100 669 827 134
9 2
-985 -262
-952 -447
-241 -935
476 -920
742 -849
999 -527
992 781
12 898
-812 886
8 27
-988 459
-822 -477
-733 -682
-478 -990
659 -796
765 607
466 762
-708 662
46
1 9
13 96
74 83
86 86
31 81
76 95
28 68
52 78
73 93
16 92
7 52
57 85
51 82
80 99
56 80
22 65
73 86
2 33
69 69...

output:

2301237.844075398623
397173.554189415766
0.000000000000
0.000000000000
170724.789693800326
0.000000000000
284680.048954984265
613.986460865252
0.000000000000
363900.370509954960
1001711.550890869471
0.000000000000
1805.388078752059
0.000000000000
0.000000000000
431073.530725930947
0.000000000000
160...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 374ms
memory: 4204kb

input:

3000
36 28 965 -40 913
8 290
-933 539
-647 -708
-94 -797
499 -690
844 169
802 576
-373 648
-928 639
6 400
-951 -965
884 -896
739 661
618 933
-789 995
-895 -255
53
66 98
1 30
0 25
77 77
2 4
27 62
62 91
92 96
33 69
17 100
66 66
17 67
18 27
48 80
16 47
17 90
45 96
14 61
15 82
81 85
86 89
22 82
70 85
67...

output:

0.000000000000
801410.162237803276
1098530.622983231772
0.000000000000
4041049.994031163536
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.00000000000...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 131ms
memory: 5192kb

input:

60
-2 -1 6 -692 -914
5 1
-39 64
14 -67
53 -14
59 5
37 51
7 5
-105 23
-63 -14
-24 -17
4 -19
12 -17
-16 23
-24 26
948
6 6
1 4
3 8
444 444
9 758
4 8
212 985
365 415
629 647
168 395
55 746
2 7
69 616
595 900
5 7
6 9
8 8
181 424
3 9
5 5
228 978
622 711
714 948
6 7
152 152
878 878
62 966
2 5
1 8
99 131
86...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 129ms
memory: 5008kb

input:

60
2 -1 10 -9 -5
6 3
-64 -9
-25 -20
3 -16
26 7
-2 18
-41 14
118 8
-13458 1788
-13400 -150
-13174 -3448
-12376 -10187
-11659 -16224
-11423 -18192
-11178 -19459
-9694 -24458
-9018 -26389
-8654 -27421
-7753 -29655
-6590 -32133
-5887 -33359
-4543 -35667
-4092 -36278
-3268 -37365
-2246 -38667
-1091 -4006...

output:

4498.979591834690
4498.979591834721
4498.979591834363
4498.979591834362
4498.979591834360
4498.979591834365
4498.979591834775
4498.979591834495
4498.979591834363
4498.979591834584
4498.979591834902
4498.979591834902
4498.979591834739
4498.979591834362
4498.979591834606
4498.979591834870
4498.9795918...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 91ms
memory: 4860kb

input:

60
3 4 8 6 -6
8 4
-70 -8
-20 -7
33 11
35 58
33 75
-11 81
-48 63
-54 57
7 5
0 3
12 -7
34 -23
64 -42
79 -46
117 -27
80 24
3319
185 435
764 879
7 282
2 5
116 767
499 763
1 1
2 8
400 627
103 489
563 795
43 860
427 512
24 353
123 123
257 896
2 4
3 7
498 498
896 992
1 6
138 890
228 739
397 519
651 868
0 9...

output:

0.000000000000
0.000000000000
2069.541528094111
1549.843839348479
0.000000000000
0.000000000000
590.322713468104
2196.024181640894
0.000000000000
0.000000000000
0.000000000000
183.601466477139
0.000000000000
1328.625978085828
0.000000000000
0.000000000000
1346.380080449786
2181.356032706118
0.000000...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 109ms
memory: 4932kb

input:

60
-10 4 99050 -3 6
7 26049
-45 27
53 -70
97 -112
110 -89
122 -47
123 -35
88 39
11 77577
-14 17
-11 -30
9 -80
52 -75
110 -65
143 -36
161 40
158 58
122 70
89 65
4 43
2233
161 663
162 922
6 8
889 963
232 251
661 739
818 971
7 10
287 999
1 6
5 9
0 3
466 749
277 277
4 10
236 442
871 925
2 9
207 843
374 ...

output:

0.000000000000
0.000000000000
13309.804936665047
0.000000000000
0.000000000000
0.000000000000
0.000000000000
9522.143117984778
0.000000000000
20072.626887939734
13269.480002610861
22224.336961861624
0.000000000000
0.000000000000
13186.177447138521
0.000000000000
0.000000000000
16304.290416346361
0.0...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 124ms
memory: 4740kb

input:

60
-14255 85728 83963 -625 308
6 7088
-10 10
-8 -41
19 -75
119 -24
163 10
182 44
406 8385
-17623 -590
-17616 -755
-17575 -1522
-17432 -4162
-17366 -4990
-17355 -5120
-17302 -5701
-17280 -5928
-17188 -6832
-17103 -7636
-17051 -8062
-16943 -8925
-16884 -9331
-16757 -10203
-16742 -10303
-16725 -10408
-...

output:

13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723905
13749.416020723...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 94ms
memory: 4896kb

input:

60
6 1 98772 -10 0
9 50424
-173 -37
-50 -40
-35 -38
-31 -35
-8 21
-8 24
-13 95
-91 93
-158 90
252 60791
-46140 5792
-46125 3833
-46121 3699
-46025 1061
-45927 -1169
-45841 -2463
-45718 -3974
-45673 -4509
-45536 -6005
-45390 -7474
-45234 -8942
-45170 -9480
-44996 -10847
-44670 -12865
-44082 -15910
-4...

output:

82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347766
82574.646507347...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 111ms
memory: 4700kb

input:

60
-4177 -13751 89389 6 -9
6 23007
-90 -47
-26 -74
38 -85
76 41
38 52
-26 11
13 59759
-74 -6
-69 -30
-47 -32
-45 -32
-29 -31
11 -21
82 -2
74 20
57 29
52 31
-3 32
-49 31
-73 4
2743
376 815
158 554
31 497
566 652
134 242
1 7
103 680
8 8
1 9
191 530
190 190
465 526
380 957
1 10
929 987
1 1
2 5
267 817
...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 97ms
memory: 4860kb

input:

60
10 -7 76710 1 -10
15 1799
-107 125
-97 40
-80 -29
-76 -35
-40 -34
-17 -30
-11 -28
7 -15
9 40
3 64
-13 113
-15 117
-21 126
-61 139
-96 145
14 4198
-108 39
-107 29
-101 10
-71 -27
-36 -62
1 -70
27 -52
51 -17
58 6
44 68
18 87
-26 83
-55 76
-106 60
3271
1 8
298 463
507 992
493 766
641 641
5 8
4 4
300...

output:

11344.039313173135
6161.774380145486
179.161154846521
433.038947696752
0.000000000000
11400.038076933261
11330.306206624229
2416.383562415486
11344.184722841022
4888.435144165138
1302.483521772964
5021.530436202830
9386.191084744387
1111.504300729281
11315.942991514480
11358.329823448940
13468.38999...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 125ms
memory: 5028kb

input:

60
85399 -87912 4 -5 2
6 1
-19 34
10 -4
44 -28
104 2
134 20
40 38
5 3
-122 -3
1 -23
61 -13
50 7
-10 79
229
714 801
683 855
3 10
42 609
3 6
5 5
98 637
0 10
0 6
7 8
665 995
4 6
337 664
3 8
374 855
637 637
143 318
6 8
27 365
287 327
4 5
41 960
1 3
154 820
73 394
18 636
0 5
859 880
4 8
382 470
491 840
6...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 138ms
memory: 5044kb

input:

60
-10 7 7 1 5
6 1
-162 -58
-24 -49
-6 -7
-10 17
-24 36
-86 41
648 4
-23029 2131
-23020 1272
-23019 1186
-23017 1020
-23015 906
-23008 584
-22997 156
-22992 -27
-22984 -265
-22972 -592
-22943 -1360
-22914 -2016
-22903 -2230
-22896 -2363
-22847 -3242
-22811 -3860
-22741 -5008
-22710 -5485
-22692 -576...

output:

13636.972222222824
13636.972222222855
13636.972222222855
13636.972222222856
13636.972222222849
13636.972222222855
13636.972222222853
13636.972222222810
13636.972222222854
13636.972222222829
13636.972222222855
13636.972222222831
13636.972222222831
13636.972222222854
13636.972222222847
13636.972222222...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 599ms
memory: 5992kb

input:

60
15682 -4744 10 10 2
743 3
-15894 -2108
-15889 -2921
-15885 -3142
-15876 -3485
-15870 -3697
-15861 -3979
-15848 -4333
-15811 -5217
-15798 -5508
-15785 -5776
-15775 -5971
-15772 -6024
-15754 -6327
-15751 -6372
-15728 -6655
-15708 -6893
-15700 -6983
-15611 -7954
-15598 -8095
-15590 -8179
-15558 -851...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 516ms
memory: 5808kb

input:

60
-8064 19156 8 6 0
728 2
-9570 256
-9569 -101
-9568 -313
-9559 -1075
-9556 -1302
-9551 -1625
-9540 -2015
-9537 -2112
-9532 -2260
-9520 -2581
-9519 -2605
-9501 -2996
-9499 -3039
-9486 -3312
-9482 -3388
-9456 -3758
-9437 -4025
-9412 -4331
-9405 -4407
-9315 -5328
-9261 -5813
-9237 -6025
-9232 -6069
-...

output:

1997087249.526728395373
1997195902.058432635153
1996978600.206966284080
1996848106.037512057577
1959497389.333039184334
1997022081.133674712735
1997195900.452460172470
1985049143.007763383794
1971255131.630998144159
1955292374.690283770557
1959805154.738721462199
1972371846.357066592202
1997065536.3...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 595ms
memory: 5912kb

input:

60
16409 -38207 8 -5 2
744 1
-14468 -2661
-14467 -2844
-14466 -3006
-14465 -3132
-14459 -3703
-14456 -3918
-14454 -4054
-14451 -4254
-14448 -4408
-14432 -5131
-14419 -5604
-14415 -5743
-14409 -5942
-14408 -5972
-14406 -6029
-14404 -6085
-14368 -7053
-14352 -7450
-14329 -7995
-14311 -8406
-14293 -876...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 625ms
memory: 5800kb

input:

60
27332 65498 94576 -4 -10
689 4897
-7628 -631
-7626 -722
-7624 -801
-7617 -1002
-7613 -1070
-7609 -1133
-7608 -1145
-7604 -1189
-7595 -1281
-7592 -1309
-7577 -1421
-7559 -1555
-7556 -1572
-7533 -1661
-7521 -1706
-7507 -1755
-7486 -1825
-7469 -1880
-7457 -1911
-7443 -1946
-7422 -1997
-7339 -2195
-7...

output:

160563494.274389295257
160510702.013506964417
160500143.478542470213
168053074.245291984538
160584611.043270899419
168327556.687805736656
170603640.505139571513
160595169.540604469745
177793598.400546591467
169560447.787342394862
176699636.063546468038
160626844.430510406615
160468467.647863441991
1...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 580ms
memory: 6032kb

input:

60
-5 3 72675 -283 -74
739 14232
-10968 -3618
-10966 -4287
-10964 -4465
-10958 -4734
-10947 -5225
-10925 -5992
-10917 -6262
-10909 -6489
-10892 -6934
-10855 -7884
-10849 -8033
-10836 -8340
-10826 -8563
-10811 -8879
-10786 -9397
-10762 -9829
-10746 -10098
-10725 -10425
-10712 -10620
-10690 -10947
-10...

output:

3412605691.923531457549
3364513364.646997956559
5701557339.693795257714
4745145647.639686475974
5701394995.947171916254
5701151837.179540806916
5701520196.040895797312
5540562065.018980845809
4373902356.289028102066
3409467708.826334851095
5076629690.067754273303
5701557339.693795160390
5701557339.6...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 107ms
memory: 12512kb

input:

1
-100000 -100000 95539 1 1
4924 27493
-49998 -2337
-49997 -2614
-49996 -2812
-49995 -2999
-49994 -3146
-49993 -3280
-49992 -3405
-49991 -3524
-49989 -3741
-49988 -3846
-49987 -3941
-49986 -4034
-49985 -4124
-49983 -4289
-49982 -4371
-49980 -4527
-49978 -4679
-49976 -4826
-49975 -4897
-49973 -5035
-...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 56ms
memory: 6508kb

input:

1
100000 100000 79129 -1 -1
1974 7644
-24991 -2249
-24990 -2309
-24989 -2368
-24988 -2423
-24987 -2474
-24986 -2522
-24984 -2614
-24983 -2659
-24981 -2735
-24980 -2772
-24979 -2808
-24978 -2842
-24977 -2875
-24974 -2971
-24970 -3095
-24966 -3215
-24964 -3273
-24963 -3301
-24962 -3327
-24958 -3427
-2...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 113ms
memory: 8612kb

input:

1
-100000 100000 66194 1 -1
4800 11259
-99982 -37373
-99981 -37487
-99979 -37713
-99978 -37814
-99977 -37911
-99975 -38103
-99974 -38192
-99973 -38272
-99971 -38428
-99970 -38501
-99969 -38573
-99967 -38715
-99965 -38848
-99963 -38979
-99962 -39038
-99960 -39155
-99959 -39210
-99958 -39264
-99957 -3...

output:

3705213757.820911902236
3679576489.683725634823
3671089348.213089931756
3674502015.920542146778
3705213758.098106832942
3685172897.281904729782
3692742780.379033182515
3680749261.018608347978
3666710875.215509566246
3676528921.890340019483
3668119007.064184750430
3670021327.808909364976
3678303905.8...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed