QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592496#7081. Cut the PlaneAfterlifeAC ✓539ms3964kbC++209.3kb2024-09-26 22:58:582024-09-26 22:58:59

Judging History

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

  • [2024-09-26 22:58:59]
  • 评测
  • 测评结果:AC
  • 用时:539ms
  • 内存:3964kb
  • [2024-09-26 22:58:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define int long long

const int N=1e2+1e1+7,L=12;

struct P{
    int x,y;
    P(int _x=0,int _y=0){x=_x,y=_y;}
};

P operator *(const P &a,const int &b)
{
    return {a.x*b,a.y*b};
}

P operator -(const P &a,const P &b)
{
    return {a.x-b.x,a.y-b.y};
}

P operator +(const P &a,const P &b)
{
    return {a.x+b.x,a.y+b.y};
}

int T;

int sgn(int x)
{
    return x<-0?-1:(x>0);
}

int det(P a,P b)
{
    return a.x*b.y-a.y*b.x;
}

int dot(P a,P b)
{
    return a.x*b.x+a.y*b.y;
}

int in_seg(P a,P b,P c)
{
    return sgn(det(b-a,c-a))==0&&sgn(dot(a-c,b-c))<=0;
}

int segment_intersection(P a,P b,P c,P d)
{
    if(sgn(det(b-a,c-a))*sgn(det(b-a,d-a))==-1&&sgn(det(d-c,a-c))*sgn(det(d-c,b-c))==-1)
        return 1;
    if(in_seg(a,b,d)||in_seg(a,b,c)||in_seg(c,d,a)||in_seg(c,d,b))
        return 1;
    return 0;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>T;
    while(T--)
    {
        int n;
        cin>>n;
        // n=100;
        vector<P>p(n);
        for(auto &[x,y]:p)
        {
            // x=rand()%10000,y=rand()%10000;
            // x*=2,y*=2;
            cin>>x>>y;
        }
        if(n==1)
        {
            cout<<(int)1e8<<" "<<(int)1e8<<" "<<(int)1e8+1<<" "<<(int)1e8<<"\n";
            continue;
        }
        sort(p.begin(),p.end(),[&](const P &a,const P &b){
            if(a.y!=b.y)
                return a.y<b.y;
            return a.x>b.x;
        });
        int h=n/2;
        P m=(p[h-1]+p[h]);
        m.x/=2,m.y/=2;
        vector<pair<P,P> >ans;
        P A=m+P(1e8,0);
        P B=m+P(-1e8,0);
        P mab,mcd;
        while(1)
        {
            mab=A,mcd=B;
            mab.x+=rand()%L-L/2;
            mab.y+=rand()%L-L/2;
            mcd.x+=rand()%L-L/2;
            mcd.y+=rand()%L-L/2;
            int ok=1;
            for(int i=0;i<n;i++)
            {
                if(in_seg(mab,mcd,p[i]))
                {
                    ok=0;
                    break;
                }
            }
            for(int i=0;i<h;i++)
            {
                if(!ok)
                    break;
                for(int j=h;j<n;j++)
                    if(!segment_intersection(p[i],p[j],mab,mcd))
                    {
                        ok=0;
                        break;
                    }
            }
            if(ok)
                break;
        }
        ans.push_back({mab,mcd});
        random_shuffle(p.begin(),p.begin()+h);
        random_shuffle(p.begin()+h,p.begin()+n);
        // sort(p.begin(),p.begin()+h,[&](const P &a,const P &b){
        //     if(a.x!=b.x)
        //         return a.x<b.x;
        //     return a.y<b.y;
        // });
        // sort(p.begin()+h,p.begin()+n,[&](const P &a,const P &b){
        //     if(a.x!=b.x)
        //         return a.x<b.x;
        //     return a.y<b.y;
        // });
        // int u=0,v=h;
        using pii=pair<int,int>;
        deque<pii> q1,q2;
        for(int i=0;i<h;i++)
            for(int j=i+1;j<h;j++)
                q1.push_back({i,j});
        for(int i=h;i<n;i++)
            for(int j=i+1;j<n;j++)
                q2.push_back({i,j});
        while(!q1.empty()&&!q2.empty())
        {
            while(q1.size())
            {
                auto [a,b]=q1.front();
                int ok=0;
                for(auto [u,v]:ans)
                    if(segment_intersection(p[a],p[b],u,v))
                    {
                        ok=1;
                        break;
                    }
                if(ok)
                    q1.pop_front();
                else
                    break;
            }
            
            while(q2.size())
            {
                auto [a,b]=q2.front();
                int ok=0;
                for(auto [u,v]:ans)
                    if(segment_intersection(p[a],p[b],u,v))
                    {
                        ok=1;
                        break;
                    }
                if(ok)
                    q2.pop_front();
                else
                    break;
            }
            if(!q1.size()||!q2.size())
                break;
            auto [ia,ib]=q1.front();
            auto [ic,id]=q2.front();
            q1.pop_front(),q2.pop_front();
            P a=p[ia],b=p[ib],c=p[ic],d=p[id];
            if(rand()%2)
                swap(a,b);
            if(rand()%2)
                swap(c,d);
            P mab=a;
            // mab.x/=2,mab.y/=2;
            P mcd=c;
            // mcd.x/=2,mcd.y/=2;
            // P dir=a+b-c-d;
            P dir=a-c;
            mab=mab+dir*50000;
            mcd=mcd-dir*50000;
            P A=mab,B=mcd;
            int lim=10,ok=1;
            while(lim--)
            {
                mab=A;
                mcd=B;
                mab.x+=rand()%L-L/2;
                mcd.x+=rand()%L-L/2;
                mab.y+=rand()%L-L/2;
                mcd.y+=rand()%L-L/2;
                ok=1;
                for(int i=0;i<n;i++)
                {
                    if(!ok)
                        break;
                    if(in_seg(mab,mcd,p[i]))
                        ok=0;
                }
                if(!segment_intersection(mab,mcd,a,b)||!segment_intersection(mab,mcd,c,d))
                    ok=0;
                if(ok)
                    break;
            }
            if(!ok)
            {
                q1.push_back({ia,ib});
                q2.push_front({ic,id});
            }
            else
                ans.push_back({mab,mcd});
        }
        while(q1.size())
        {
            while(q1.size())
            {
                auto [a,b]=q1.front();
                int ok=0;
                for(auto [u,v]:ans)
                    if(segment_intersection(p[a],p[b],u,v))
                    {
                        ok=1;
                        break;
                    }
                if(ok)
                    q1.pop_front();
                else
                    break;
            }
            if(!q1.size())
                break;
            P a=p[q1.front().first],b=p[q1.front().second];
            q1.pop_front();
            P m=(a+b);
            m.x/=2,m.y/=2;
            P A=P(m.x,m.y+1e8),B=P(m.x,m.y-1e8);
            P mab,mcd;
            while(1)
            {
                mab=A;
                mcd=B;
                mab.x+=rand()%L-L/2;
                mcd.x+=rand()%L-L/2;
                mab.y+=rand()%L-L/2;
                mcd.y+=rand()%L-L/2;
                int ok=1;
                for(int i=0;i<n;i++)
                {
                    if(!ok)
                        break;
                    if(in_seg(mab,mcd,p[i]))
                        ok=0;
                }
                if(!segment_intersection(mab,mcd,a,b))
                    ok=0;
                if(ok)
                    break;

            }
            ans.push_back({mab,mcd});

        }
        while(q2.size())
        {
            while(q2.size())
            {
                auto [a,b]=q2.front();
                int ok=0;
                for(auto [u,v]:ans)
                    if(segment_intersection(p[a],p[b],u,v))
                    {
                        ok=1;
                        break;
                    }
                if(ok)
                    q2.pop_front();
                else
                    break;
            }
            if(!q2.size())
                break;
            P a=p[q2.front().first],b=p[q2.front().second];
            q2.pop_front();
            P m=(a+b);
            m.x/=2,m.y/=2;
            P A=P(m.x,m.y+1e8),B=P(m.x,m.y-1e8);
            
            P mab,mcd;
            while(1)
            {
                mab=A;
                mcd=B;
                mab.x+=rand()%L-L/2;
                mcd.x+=rand()%L-L/2;
                mab.y+=rand()%L-L/2;
                mcd.y+=rand()%L-L/2;
                int ok=1;
                for(int i=0;i<n;i++)
                {
                    if(!ok)
                        break;
                    if(in_seg(mab,mcd,p[i]))
                        ok=0;
                }
                if(!segment_intersection(mab,mcd,a,b))
                    ok=0;
                if(ok)
                    break;

            }
            ans.push_back({mab,mcd});

        }
        for(auto &[a,b]:ans)
        {
            cout<<a.x<<" "<<a.y<<" "<<b.x<<" "<<b.y<<"\n";
        }
        int z=1e8;
        int tot=(n+1)/2;
        while(ans.size()<tot)
        {
            cout<<(int)z<<" "<<(int)z<<" "<<(int)z+1<<" "<<(int)z<<"\n";
            z++;
            tot--;
        }

        // int ok=1;
        // // ok&=ans.size()==(n+1)/2;
        // for(int i=0;i<n;i++)
        // {
        //     for(auto [u,v]:ans)
        //     {
        //         if(in_seg(u,v,p[i]))
        //             ok=0;
        //     }
        //     for(int j=i+1;j<n;j++)
        //     {
        //         int flag=0;
        //         for(auto [u,v]:ans)
        //             if(segment_intersection(p[i],p[j],u,v))
        //                 flag=1;
        //         ok&=flag;
        //     }
        // }
        // cout<<ok<<endl;
    }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
0 0
2 1
4 0
4
0 1
1 0
2 1
1 2

output:

99999998 4 -99999995 -4
-1 100000005 3 -100000004
99999997 3 -99999995 -1
50004 -50004 -49999 50002

result:

ok 2 cases

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

4
2
0 0
3 0
3
0 0
3 0
3 3
4
0 0
3 0
3 3
0 3
4
0 0
3 0
1 1
0 3

output:

99999997 4 -99999996 -4
99999999 4 -99999995 -4
3 99999996 -2 -100000004
100000003 1 -99999999 2
-1 -149998 4 150000
100000004 -3 -100000006 5
150000 -150001 -150001 150007

result:

ok 4 cases

Test #3:

score: 0
Accepted
time: 118ms
memory: 3548kb

input:

18093
1
-883 286
1
922 -705
3
614 -576
611 -576
607 -572
10
748 868
751 873
752 869
747 864
743 865
746 864
745 868
746 874
750 869
742 866
5
494 618
491 613
497 617
492 619
498 611
10
-639 -359
-634 -358
-642 -355
-638 -361
-638 -357
-634 -357
-641 -360
-639 -353
-633 -362
-642 -359
9
-327 -157
-32...

output:

100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000608 -572 -99999385 -580
611 99999423 604 -100000577
100000742 870 -99999250 866
-149253 -449141 150743 450879
-299255 -249141 300747 250872
-349261 -199131 350753 200865
-249254 -449139 250751 450876
100000496 618 ...

result:

ok 18093 cases

Test #4:

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

input:

18174
9
398 -265
397 -261
399 -265
399 -267
404 -268
402 -269
400 -262
398 -266
401 -261
3
-128 -721
-128 -723
-127 -722
8
-28 62
-25 56
-30 61
-25 61
-30 55
-26 59
-24 57
-28 56
8
-91 -145
-88 -148
-92 -143
-88 -142
-91 -146
-93 -149
-93 -145
-94 -141
7
375 -521
370 -517
371 -519
370 -520
368 -516
...

output:

100000392 -265 -99999604 -267
397 -100271 399 99737
100404 -350271 -99602 349735
200400 -200270 -199597 199738
400 99999739 401 -100000259
99999874 -717 -100000131 -728
-133 99999284 -122 -100000727
99999975 61 -100000023 55
-23 -249944 -27 250060
49970 -149949 -50021 150061
-33 -299950 -25 300063
9...

result:

ok 18174 cases

Test #5:

score: 0
Accepted
time: 92ms
memory: 3664kb

input:

18276
3
934 -359
916 -349
925 -349
9
-518 -436
-520 -428
-509 -430
-523 -432
-511 -417
-506 -427
-508 -420
-516 -432
-521 -426
1
762 -777
4
46 -219
32 -208
45 -215
43 -226
5
275 572
269 571
284 563
285 558
274 572
10
-196 886
-193 886
-187 888
-184 905
-198 890
-199 894
-203 888
-186 899
-186 900
-1...

output:

100000930 -350 -99999068 -353
921 99999645 924 -100000346
99999487 -424 -100000510 -435
-150507 -150433 149488 149578
-100525 -300437 99481 299576
99487 -400432 -100523 399574
-506 99999577 -514 -100000418
100000000 100000000 100000001 100000000
100000049 -218 -99999961 -215
50048 -200219 -49957 199...

result:

ok 18276 cases

Test #6:

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

input:

18212
6
-133 -816
-133 -826
-122 -822
-127 -828
-132 -815
-131 -832
5
-341 -553
-343 -558
-336 -541
-343 -557
-347 -557
1
-36 -721
8
5 -44
9 -33
16 -35
3 -38
1 -42
1 -40
0 -36
6 -36
4
235 210
242 214
248 214
241 226
6
-779 -432
-765 -419
-773 -416
-765 -427
-782 -422
-779 -426
1
-409 -252
5
69 -343
...

output:

99999876 -829 -100000131 -823
-250129 -300823 249876 299180
99870 -800833 -100132 799184
99999651 -553 -100000342 -561
-100341 -200557 99657 199447
-344 99999450 -338 -100000546
100000000 100000000 100000001 100000000
100000003 -32 -99999999 -43
-150000 -100035 150009 99960
-199993 -550043 200006 54...

result:

ok 18212 cases

Test #7:

score: 0
Accepted
time: 342ms
memory: 3804kb

input:

1958
39
-223 -168
-133 -180
-269 -262
-227 -341
-147 -282
-220 -166
-264 -362
-253 -307
-160 -353
-292 -210
-216 -356
-164 -212
-114 -347
-295 -181
-211 -279
-272 -189
-140 -179
-173 -187
-131 -265
-174 -356
-298 -227
-164 -342
-114 -235
-149 -231
-300 -169
-139 -285
-119 -323
-205 -183
-253 -222
-1...

output:

99999715 -254 -100000283 -257
-700151 -5100279 699869 5099820
-3800229 -3250293 3799850 3249766
-850285 -4400314 849736 4399772
4749832 -5450339 -4750262 5449767
6399840 -6600346 -6400288 6599792
2249834 -8500350 -2250209 8499811
-1000220 -5650299 999797 5649813
2299829 -9500353 -2300226 9499829
404...

result:

ok 1958 cases

Test #8:

score: 0
Accepted
time: 346ms
memory: 3708kb

input:

2023
75
71 -22
93 -4
171 -34
132 50
115 105
35 -21
56 70
51 -45
44 71
153 -3
106 12
139 9
86 -28
127 -30
100 94
47 100
105 15
151 85
186 31
165 -56
35 26
164 98
164 -48
33 -1
113 -52
149 42
27 40
89 -16
88 7
46 -41
130 -10
167 43
88 -23
172 17
143 76
92 -6
81 -15
107 -58
168 2
15 31
57 -52
156 56
11...

output:

100000069 13 -99999933 12
2750136 -5900010 -2749915 5900110
2150165 -3700043 -2149877 3700025
5000184 -7050039 -4999919 7050104
-4449909 -1999995 4450174 2000051
-7399970 -2249998 7400176 2250046
600176 -5050035 -599833 5050070
3100162 -4950001 -3099897 4950091
300111 -8400061 -299902 8400112
-66499...

result:

ok 2023 cases

Test #9:

score: 0
Accepted
time: 348ms
memory: 3676kb

input:

1998
58
-199 202
-191 250
-209 243
-189 197
-182 192
-176 249
-168 224
-211 202
-178 239
-226 228
-176 221
-184 223
-188 219
-190 242
-199 236
-206 219
-205 188
-183 230
-202 244
-213 243
-230 209
-203 261
-186 237
-201 222
-200 241
-179 261
-204 256
-185 210
-182 233
-204 214
-179 210
-168 241
-232...

output:

99999782 228 -100000219 222
249831 -2699794 -250176 2700262
1099835 -2099794 -1100185 2100247
49816 -1249783 -50183 1250242
-800187 -899775 799836 900246
2199817 -949784 -2200234 950241
1049826 -1549796 -1050204 1550245
-1250214 -2799806 1249804 2800244
-450207 -1799781 449795 1800266
-750219 -14997...

result:

ok 1998 cases

Test #10:

score: 0
Accepted
time: 34ms
memory: 3596kb

input:

100000
1
-756 684
1
698 -384
1
-668 -920
1
-565 -818
1
31 -211
1
760 -246
1
-588 -604
1
-813 78
1
-340 850
1
-357 -772
1
-312 -200
1
752 -752
1
-230 727
1
961 255
1
146 581
1
956 -259
1
479 -760
1
967 -612
1
-760 -97
1
-953 643
1
518 137
1
-950 52
1
-796 193
1
-732 661
1
-716 671
1
275 266
1
235 468...

output:

100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 ...

result:

ok 100000 cases

Test #11:

score: 0
Accepted
time: 498ms
memory: 3640kb

input:

1000
100
700 -782
717 -672
709 -763
725 -677
704 -682
694 -787
696 -758
649 -770
653 -669
570 -771
546 -682
569 -707
557 -807
621 -708
682 -651
707 -693
679 -655
665 -696
725 -745
686 -770
567 -801
604 -689
643 -658
741 -753
636 -772
726 -719
653 -691
598 -719
702 -774
729 -674
613 -615
649 -702
611...

output:

100000619 -712 -99999386 -701
950623 -3950707 -949400 3949372
-3349392 -5850774 3350677 5849349
-5849434 -4650754 5850678 4649347
-2899379 -2650706 2900678 2649343
950615 -3950706 -949404 3949376
1500651 -7700767 -1499376 7699389
4050697 -8600787 -4049385 8599386
1850705 -3400774 -1849332 3399297
45...

result:

ok 1000 cases

Test #12:

score: 0
Accepted
time: 539ms
memory: 3636kb

input:

1000
100
-159 240
-179 66
-191 220
-122 120
-183 201
-220 221
-207 234
-247 152
-89 167
-125 224
-171 231
-223 84
-139 185
-219 193
-225 115
-215 170
-199 183
-218 142
-117 195
-84 110
-145 232
-147 118
-220 233
-122 165
-198 60
-232 100
-116 187
-263 183
-155 93
-198 73
-195 137
-132 71
-172 135
-1...

output:

99999769 157 -100000227 155
-350133 -8149942 349877 8150223
-3600196 -6199947 3599884 6200179
-3450190 -8499950 3449882 8500219
-5700233 -5449882 5699882 5450225
-219 -5499902 -228 5500209
-1100185 -4249842 1099843 4250236
-2800217 -7599912 2799843 7600235
549924 -1649860 -550088 1650179
-300123 -51...

result:

ok 1000 cases

Test #13:

score: 0
Accepted
time: 413ms
memory: 3640kb

input:

1000
100
422 747
339 -719
-600 -376
-226 79
244 6
879 -891
-63 717
403 809
259 -940
254 -26
135 -309
-517 -308
-479 -859
-270 484
292 -744
696 870
957 45
144 288
608 -601
176 350
709 951
831 281
-925 -791
277 -923
-956 692
142 652
491 398
942 -524
155 -46
341 540
978 -552
465 707
-316 36
-509 45
77 ...

output:

99999973 -19 -100000025 -22
-44100476 -83400861 44100397 83400811
-25799759 -47150099 25800766 47150840
-15350174 -26600493 15350130 26600041
-44100479 -83400863 44100408 83400814
-5500756 -68450796 5499362 68450566
-40350951 -73800938 40349859 73800540
50450865 -49100448 -50450141 49100529
19650251...

result:

ok 1000 cases

Test #14:

score: 0
Accepted
time: 421ms
memory: 3708kb

input:

1000
100
-504 117
-458 409
942 45
764 -595
196 390
-186 655
-597 -266
-745 -551
-73 307
727 -95
729 -120
-60 -470
413 -43
-642 -378
51 -650
23 206
216 195
392 556
131 538
-161 -43
-209 -210
576 115
-4 59
-19 303
-65 511
887 10
-277 921
26 -705
180 -536
750 -388
952 83
-800 -596
-652 525
-745 463
-89...

output:

100000167 -12 -99999831 -15
3099884 -71500662 -3100187 71500772
18650302 -54200571 -18650062 54200509
3150058 -29350532 -3150008 29350057
3099881 -71500664 -3100176 71500775
-2750798 -52950596 2749258 52950465
-36750802 -55350595 36749932 55350510
16750722 -32550096 -16749613 32550557
14300473 -5210...

result:

ok 1000 cases

Test #15:

score: 0
Accepted
time: 101ms
memory: 3864kb

input:

18046
2
-571 956
-576 946
1
878 198
9
-22 -863
-24 -886
-29 -889
-27 -868
-22 -895
-24 -889
-25 -864
-27 -892
-29 -878
4
-846 -454
-839 -427
-840 -439
-846 -453
10
-282 43
-279 40
-275 44
-280 45
-278 52
-277 67
-277 51
-283 58
-283 45
-279 65
7
-423 943
-431 919
-428 929
-424 922
-426 950
-424 944
...

output:

99999428 955 -100000570 952
100000000 100000000 100000001 100000000
99999968 -887 -100000028 -889
99976 -700887 -100026 699124
-350030 -1300884 349982 1299142
99978 -700898 -100029 699120
-18 99999132 -27 -100000867
99999154 -451 -100000838 -441
-350841 -1300448 349157 1299571
99999719 46 -100000280...

result:

ok 18046 cases

Test #16:

score: 0
Accepted
time: 99ms
memory: 3612kb

input:

18177
8
465 873
435 867
466 875
461 870
433 867
441 868
454 873
427 875
9
-593 -296
-595 -291
-608 -295
-595 -293
-603 -296
-597 -295
-587 -292
-613 -297
-602 -292
4
-521 -789
-508 -793
-524 -791
-488 -792
1
990 42
5
961 436
990 428
969 430
992 432
964 432
5
824 -790
822 -794
788 -792
792 -790
795 -...

output:

100000457 871 -99999539 869
-1049567 -299137 1050449 300874
-199543 -149128 200461 150867
300433 -399132 -299573 400875
99999395 -291 -100000602 -299
-50605 -200299 49393 199702
-300590 -200292 299412 199708
-50602 -200295 49403 199709
-592 99999708 -598 -100000293
99999498 -792 -100000503 -791
1649...

result:

ok 18177 cases

Test #17:

score: 0
Accepted
time: 106ms
memory: 3828kb

input:

18123
10
-108 87
-109 31
-107 61
-108 71
-110 81
-109 41
-107 77
-110 80
-111 92
-111 85
3
637 870
638 923
638 915
7
-917 -249
-917 -203
-921 -193
-921 -248
-919 -190
-919 -231
-918 -218
2
-712 -595
-711 -640
10
-330 -647
-331 -627
-331 -673
-330 -653
-329 -680
-329 -639
-332 -629
-332 -631
-333 -61...

output:

99999886 78 -100000110 76
149890 -199921 -150107 200077
49892 -2499967 -50110 2500084
149895 -999938 -150112 1000083
99893 -2699968 -100113 2700088
100000633 894 -99999365 897
640 100000919 636 -99999081
99999079 -221 -100000919 -221
-50920 -650229 49082 649776
99077 -2950250 -100915 2949813
-918 99...

result:

ok 18123 cases

Test #18:

score: 0
Accepted
time: 110ms
memory: 3604kb

input:

18150
1
-177 -765
8
812 -464
800 -465
722 -463
819 -466
792 -464
787 -462
733 -465
724 -463
6
56 230
42 230
21 231
44 232
4 229
40 229
5
-864 -737
-904 -735
-913 -735
-871 -737
-896 -734
5
-902 -24
-858 -26
-931 -24
-850 -23
-871 -23
4
465 509
478 509
401 510
415 511
10
387 419
406 418
415 418
366 4...

output:

100000000 100000000 100000001 100000000
100000805 -461 -99999196 -467
650796 -150470 -649216 149543
4400810 -50467 -4399278 49540
1350816 -100464 -1349211 99534
100000048 231 -99999956 229
-850000 -99773 850021 100229
600060 -99775 -599955 100234
99999116 -736 -100000886 -738
1599136 -150738 -160089...

result:

ok 18150 cases

Test #19:

score: 0
Accepted
time: 393ms
memory: 3660kb

input:

1335
89
484 -550
462 -777
456 -622
439 -485
492 -621
473 -595
474 -781
498 -538
445 -662
459 -842
471 -619
434 -555
484 -606
495 -653
437 -558
467 -513
474 -715
491 -690
448 -754
432 -724
505 -654
443 -820
441 -502
477 -566
453 -718
501 -834
496 -836
487 -711
475 -622
449 -520
461 -715
436 -491
467 ...

output:

100000471 -667 -99999534 -656
350476 -12500729 -349532 12499520
-1599558 -12600735 1600473 12599521
750453 -16550835 -749562 16549500
1400459 -11050714 -1399573 11049502
1300456 -13150833 -1299569 13149432
1200459 -10450837 -1199564 10449372
2350474 -7600728 -2349565 7599426
2450488 -16800841 -24495...

result:

ok 1335 cases

Test #20:

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

input:

1330
65
129 802
297 880
322 871
271 838
403 871
269 824
241 821
382 872
121 852
315 819
362 807
249 817
246 841
218 804
138 806
444 829
430 837
453 824
409 860
157 878
159 804
223 869
409 857
431 821
216 825
311 809
138 855
386 854
93 842
484 802
206 864
431 839
298 814
405 826
112 879
469 855
347 8...

output:

100000313 839 -99999689 838
10250362 -3549188 -10249843 3550875
10250358 -3549199 -10249840 3550876
-2049636 -3199198 2050399 3200874
1750376 -699173 -1749663 700846
-12649866 -3499195 12650380 3500866
-8399785 -2499197 8400387 2500859
-12099841 -3449201 12100393 3450870
-1749791 -1199180 1750243 12...

result:

ok 1330 cases

Test #21:

score: 0
Accepted
time: 437ms
memory: 3960kb

input:

1345
75
538 -338
-229 -369
269 -376
-273 -387
151 -342
223 -353
-347 -385
331 -340
414 -345
246 -348
581 -332
35 -382
155 -378
333 -344
140 -388
352 -383
-183 -364
164 -334
556 -373
-172 -359
312 -350
-197 -347
534 -332
-378 -335
268 -346
-346 -358
146 -373
163 -334
-300 -388
29 -379
-359 -359
353 -...

output:

99999738 -356 -100000263 -362
-15399775 -1600359 15400531 1599668
-19850383 -1850383 19850010 1849654
-9200174 -650363 9200012 649656
3150220 -1500361 -3149841 1499660
-15399778 -1600362 15400535 1599665
23400089 -1350368 -23400383 1349664
4749900 -700358 -4750194 699649
18300028 -2400378 -18300344 ...

result:

ok 1345 cases

Test #22:

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

input:

1334
88
-249 -423
-282 -8
-270 -266
-260 57
-307 -508
-304 161
-251 210
-270 -212
-254 197
-267 -25
-266 201
-280 -570
-299 -290
-285 -131
-257 -150
-273 53
-268 307
-307 256
-297 273
-248 -385
-277 -299
-272 158
-272 -472
-253 242
-301 0
-274 13
-292 -397
-286 -517
-306 234
-252 262
-271 264
-275 -...

output:

99999737 -199 -100000261 -202
49727 -29250578 -50272 29250007
49723 -29250576 -50275 29250009
-700273 -18900571 699741 18899806
-1750288 -12350402 1749744 12349851
1299722 -40200574 -1300308 40200232
199697 -41400567 -200304 41400256
-1750290 -30600555 1749739 30600062
-2500305 -28650572 2499752 286...

result:

ok 1334 cases

Test #23:

score: 0
Accepted
time: 416ms
memory: 3644kb

input:

1335
54
-228 265
127 279
134 255
-544 249
-719 263
80 282
649 259
-202 265
-61 275
58 248
258 273
-22 254
850 270
689 246
453 261
-301 264
328 276
554 252
752 264
992 251
981 281
814 281
805 275
-326 267
-112 243
35 252
864 260
3 258
-31 246
-105 282
-553 280
-288 262
-915 269
840 262
95 276
730 269...

output:

100000017 264 -99999985 263
-24150547 -1299755 24149944 1300276
-24150541 -1299753 24149933 1300277
13150040 -649746 -13150230 650267
-16350393 -1249754 16349937 1250273
-24049971 -1249750 24050518 1250277
-34749963 -849748 34750733 850271
-12949452 -1249757 12950808 1250269
-12999441 -1449754 13000...

result:

ok 1335 cases

Test #24:

score: 0
Accepted
time: 338ms
memory: 3648kb

input:

1336
66
-863 56
-864 -100
-836 807
-862 280
-839 566
-861 106
-859 -170
-858 211
-843 923
-853 441
-862 -92
-854 146
-859 -111
-838 773
-847 -196
-866 -411
-850 -579
-856 -888
-852 -694
-848 196
-856 -514
-851 690
-842 -225
-866 47
-863 191
-854 -608
-845 915
-831 537
-836 -819
-867 554
-848 -176
-8...

output:

99999146 13 -100000852 10
-400851 -70200610 399153 70200801
-400858 -70200614 399152 70200800
-500860 -65500511 499158 65500792
-1200865 -74600553 1199150 74600942
199164 -67550748 -200840 67550608
-300848 -71200581 299160 71200845
-400850 -44800582 399158 44800317
599153 -42950578 -600865 42950282
...

result:

ok 1336 cases

Test #25:

score: 0
Accepted
time: 122ms
memory: 3600kb

input:

18150
6
-631 405
-634 409
-632 412
-627 406
-628 408
-632 407
8
527 -921
522 -919
526 -925
526 -921
525 -920
529 -925
532 -926
532 -920
10
-860 -680
-861 -683
-868 -677
-865 -684
-870 -677
-864 -680
-864 -682
-870 -683
-860 -676
-866 -684
7
-768 -774
-767 -777
-772 -775
-764 -776
-769 -772
-764 -774...

output:

99999371 408 -100000631 407
49365 -349590 -50630 350412
49369 -349598 -50627 350416
100000523 -920 -99999470 -922
50527 -250931 -49473 249076
350532 -300931 -349476 299084
533 -300923 530 299080
99999134 -677 -100000868 -687
-300873 -150686 299139 149323
-50859 -150678 49138 149318
-250865 -400688 2...

result:

ok 18150 cases

Test #26:

score: 0
Accepted
time: 136ms
memory: 3900kb

input:

18154
8
-359 -77
-361 -79
-362 -72
-367 -74
-365 -77
-363 -73
-361 -73
-359 -74
5
238 443
236 444
235 445
236 443
234 437
5
576 377
570 377
569 378
575 379
572 380
9
-162 -255
-161 -249
-167 -247
-163 -247
-161 -254
-160 -248
-168 -250
-165 -250
-162 -251
3
210 -286
211 -291
216 -283
6
-676 -166
-67...

output:

99999640 -71 -100000361 -77
149641 -250081 -150359 249925
399642 -150073 -400369 149926
-367 -300074 -357 299929
100000234 446 -99999761 440
-99766 -349566 100236 350447
233 100000443 239 -99999556
100000569 376 -99999435 380
50574 -49626 -49427 50375
575 100000375 571 -99999621
99999832 -245 -10000...

result:

ok 18154 cases

Test #27:

score: 0
Accepted
time: 92ms
memory: 3552kb

input:

18138
5
713 911
717 917
716 921
708 919
713 910
3
517 818
514 832
514 836
1
573 969
4
602 -839
602 -832
604 -842
592 -836
9
742 664
734 658
737 664
741 657
727 663
731 662
729 660
739 663
734 673
10
877 -623
864 -621
876 -624
880 -617
868 -619
873 -629
866 -629
871 -618
882 -635
872 -616
5
632 -970
...

output:

100000716 918 -99999282 915
-199285 -349095 200713 350920
711 100000925 710 -99999082
100000518 822 -99999490 828
509 100000839 519 -99999168
100000000 100000000 100000001 100000000
100000599 -835 -99999408 -841
100598 -500837 -99394 499170
100000729 665 -99999263 660
-249264 -249342 250737 250663
-...

result:

ok 18138 cases

Test #28:

score: 0
Accepted
time: 92ms
memory: 3896kb

input:

18181
7
-902 122
-890 116
-904 121
-893 112
-904 109
-899 107
-891 122
8
427 843
427 829
420 829
420 834
425 831
423 839
429 828
426 833
9
-680 373
-674 380
-670 378
-666 377
-673 367
-669 384
-677 379
-668 366
-671 370
9
-487 -255
-484 -249
-490 -254
-484 -244
-485 -244
-489 -246
-485 -252
-476 -25...

output:

99999112 109 -100000895 115
-100906 -649889 99103 650119
149102 -749893 -150903 750122
-890 100000116 -891 -99999886
100000420 828 -99999573 837
100432 -749175 -99577 750839
200432 -499170 -199581 500833
-149578 -499174 150421 500841
99999326 372 -100000668 375
-100674 -549632 99337 550375
-50669 -3...

result:

ok 18181 cases

Test #29:

score: 0
Accepted
time: 341ms
memory: 3676kb

input:

2027
81
606 -200
535 -216
564 -199
528 -234
535 -197
489 -122
492 -159
591 -287
591 -291
511 -166
479 -129
590 -255
524 -246
581 -118
532 -274
560 -132
536 -229
552 -290
546 -199
639 -149
562 -292
645 -185
639 -237
492 -142
606 -253
536 -269
634 -280
503 -183
572 -123
475 -218
597 -277
499 -288
495 ...

output:

100000591 -197 -99999410 -203
500580 -5250284 -499431 5249824
4150592 -4550282 -4149490 4549803
3300628 -5200280 -3299434 5199825
3050606 -9100291 -3049457 9099892
1050587 -2550228 -1049428 2549824
-2449476 -6700246 2450573 6699886
3450572 -4300281 -3449497 4299806
-7249519 -4550282 7250631 4549817
...

result:

ok 2027 cases

Test #30:

score: 0
Accepted
time: 345ms
memory: 3688kb

input:

1985
75
-910 112
-831 95
-774 141
-774 83
-777 102
-894 214
-840 125
-895 223
-783 155
-842 121
-773 88
-873 230
-775 164
-796 160
-897 126
-764 183
-823 97
-877 100
-822 218
-809 157
-808 184
-878 75
-849 67
-901 208
-840 199
-871 119
-876 129
-866 232
-843 90
-834 168
-813 221
-896 194
-854 78
-74...

output:

99999241 154 -100000757 151
-1200826 -3249911 1199206 3250161
4049180 -5649900 -4050901 5650205
4049176 -5649911 -4050898 5650206
-2950821 -4299908 2949232 4300186
1899249 -3249887 -1900785 3250171
4049224 -4099918 -4050850 4100168
6599263 -4849865 -6600867 4850232
-2200910 -5999888 2199134 6000230
...

result:

ok 1985 cases

Test #31:

score: 0
Accepted
time: 338ms
memory: 3632kb

input:

1982
75
544 200
574 173
562 155
534 193
555 151
565 182
547 189
581 198
555 149
515 214
558 191
562 208
563 203
581 180
547 157
537 148
517 193
550 172
528 170
542 216
537 152
569 176
560 150
565 179
533 167
574 197
580 194
509 205
563 182
576 165
520 189
544 199
566 158
571 214
564 199
506 186
564 ...

output:

100000523 185 -99999479 184
-99449 -3399846 100549 3400222
-1499476 -2199820 1500551 2200216
900543 -3399845 -899474 3400227
2300565 -549817 -2299483 550191
2250563 -1899826 -2249485 1900216
2700580 -1449822 -2699480 1450205
2550564 -2749856 -2549494 2750205
2250579 -2849831 -2249471 2850220
-154949...

result:

ok 1982 cases

Test #32:

score: 0
Accepted
time: 30ms
memory: 3656kb

input:

100000
1
332 -69
1
295 -551
1
1000 517
1
-180 622
1
-262 -939
1
-94 655
1
-386 409
1
938 761
1
409 -10
1
934 381
1
603 234
1
713 285
1
-855 764
1
568 221
1
-463 -79
1
-542 676
1
129 330
1
-552 -359
1
532 167
1
21 364
1
-710 731
1
635 -994
1
730 651
1
34 -349
1
32 406
1
353 93
1
-526 -907
1
-830 -195...

output:

100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 ...

result:

ok 100000 cases

Test #33:

score: 0
Accepted
time: 501ms
memory: 3696kb

input:

1000
100
-269 -143
-257 -293
-251 -244
-247 -301
-201 -234
-246 -206
-156 -297
-72 -132
-109 -204
-137 -137
-113 -292
-127 -302
-127 -139
-98 -182
-189 -174
-205 -265
-120 -150
-234 -267
-96 -162
-204 -144
-197 -227
-222 -247
-224 -140
-81 -243
-258 -221
-174 -138
-245 -181
-124 -215
-197 -228
-221 ...

output:

99999878 -222 -100000127 -211
3599921 -3000222 -3600149 2999839
-5900251 -5750245 5899865 5749876
-5900261 -4050245 5899849 4049841
-4400237 -5400265 4399857 5399837
-4400237 -5400273 4399852 5399842
2099778 -6350267 -2100270 6349859
5849843 -6900278 -5850271 6899853
-1050155 -8800300 1049859 879986...

result:

ok 1000 cases

Test #34:

score: 0
Accepted
time: 534ms
memory: 3652kb

input:

1000
100
847 -405
805 -252
795 -278
784 -333
945 -379
857 -368
783 -309
787 -360
794 -411
844 -294
906 -379
849 -412
870 -360
871 -351
834 -383
791 -367
876 -318
910 -273
854 -298
848 -296
881 -346
920 -394
822 -368
887 -276
924 -270
839 -394
832 -298
849 -278
861 -364
896 -280
899 -422
812 -383
856...

output:

100000882 -331 -99999114 -333
1050854 -9000431 -1049162 8999747
-5399204 -5400370 5400901 5399738
-1799192 -4350386 1800850 4349701
-2149146 -8450423 2150903 8449745
1700933 -4150330 -1699096 4149748
4600928 -4200335 -4599170 4199751
5750885 -3950386 -5749239 3949696
5200895 -7200417 -5199202 719972...

result:

ok 1000 cases

Test #35:

score: 0
Accepted
time: 415ms
memory: 3704kb

input:

1000
100
624 -886
693 -542
-541 -276
946 248
-882 -696
-605 -90
498 -110
-735 834
-445 -775
-438 208
-855 -37
948 247
472 -944
499 -843
584 -177
-297 474
-348 700
850 -323
196 -224
-588 -175
-203 901
271 221
-468 -549
784 -411
-774 -497
809 -15
-270 -415
-977 26
984 -854
772 -346
-726 -39
105 849
-1...

output:

99999619 -73 -100000379 -76
61700502 -83850845 -61700741 83850836
-22449505 -54500838 22450942 54500244
61700497 -83850838 -61700731 83850838
44149985 -57200613 -44150893 57200531
22449559 -65500781 -22450892 65500535
27399553 -67100773 -27400999 67100563
84300696 -55450544 -84300990 55450561
-16699...

result:

ok 1000 cases

Test #36:

score: 0
Accepted
time: 421ms
memory: 3644kb

input:

1000
100
323 15
559 -250
-244 -680
-475 337
-42 -829
-39 107
340 -65
542 -337
328 21
-133 594
905 -215
467 491
59 -764
553 194
726 653
-374 902
478 719
599 415
-256 -418
65 -311
-47 896
771 277
400 713
549 720
-451 562
-745 -461
-863 -138
-662 55
22 -512
400 380
-479 698
770 -388
-348 -767
-556 -267...

output:

100000605 -125 -99999393 -128
-11899842 -56900759 11900401 56900375
18500165 -46600755 -18500203 46600178
-32800255 -56550416 32800401 56550718
-43550507 -64350586 43550367 64350704
-24000075 -59300802 24000405 59300376
-17049946 -57200770 17050403 57200381
-36150256 -45450421 36150471 45450485
-701...

result:

ok 1000 cases

Test #37:

score: 0
Accepted
time: 102ms
memory: 3596kb

input:

18230
4
-92 -615
-97 -607
-97 -591
-98 -594
1
423 -809
8
934 962
940 938
937 955
941 936
936 944
936 947
941 968
939 967
9
-242 -605
-236 -612
-240 -584
-242 -616
-243 -602
-243 -583
-237 -609
-240 -585
-244 -619
10
-115 -308
-121 -332
-119 -330
-113 -319
-118 -328
-114 -334
-117 -317
-120 -306
-115...

output:

99999904 -596 -100000094 -599
49900 -650611 -50093 649407
100000000 100000000 100000001 100000000
100000937 949 -99999060 951
200939 -949069 -199061 950957
-49062 -1499060 50938 1500967
-249061 -1199061 250936 1200968
99999765 -608 -100000245 -605
199758 -1400607 -200238 1399413
-200250 -1750623 199...

result:

ok 18230 cases

Test #38:

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

input:

18251
4
-328 134
-292 133
-306 132
-307 134
4
636 161
651 159
623 159
655 161
3
787 -834
773 -830
776 -833
3
462 -503
480 -509
457 -504
4
371 825
375 828
379 826
354 829
5
-759 -699
-762 -697
-795 -701
-775 -693
-771 -699
2
116 -89
122 -89
4
-154 -670
-143 -671
-131 -663
-161 -666
1
-817 127
6
317 -...

output:

99999702 134 -100000300 133
749707 -49867 -750304 50133
100000636 165 -99999361 154
-649382 -99846 650632 100159
100000786 -831 -99999222 -836
779 99999167 773 -100000826
100000473 -506 -99999537 -510
455 99999494 461 -100000506
100000371 830 -99999621 825
200375 -99176 -199627 100832
99999240 -697 ...

result:

ok 18251 cases

Test #39:

score: 0
Accepted
time: 101ms
memory: 3840kb

input:

18135
2
99 -754
100 -775
9
-439 -916
-438 -920
-440 -927
-439 -954
-441 -895
-440 -894
-441 -934
-438 -914
-437 -904
9
-480 -787
-484 -810
-480 -862
-482 -775
-483 -809
-482 -832
-483 -818
-481 -862
-484 -863
8
729 152
732 114
731 115
732 137
731 126
729 169
733 183
733 144
1
322 695
6
274 672
272 7...

output:

100000100 -760 -99999898 -763
99999556 -918 -100000440 -920
-150440 -1000934 149561 999086
-50438 -550931 49558 549085
-434 -1900953 -443 1899078
-444 99999100 -437 -100000896
99999520 -830 -100000480 -829
-50480 -2250861 49516 2249177
49523 -1150829 -50489 1149195
149525 -2200867 -150488 2199183
-4...

result:

ok 18135 cases

Test #40:

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

input:

18034
3
277 817
277 816
186 815
8
-941 -701
-926 -701
-930 -704
-918 -704
-950 -702
-942 -703
-953 -705
-905 -702
3
572 -75
583 -73
608 -73
4
-121 -66
-198 -68
-166 -69
-185 -66
8
546 600
536 602
579 599
580 600
542 603
599 599
573 601
584 601
2
-414 -8
-444 -6
2
-398 366
-361 366
2
-130 740
-212 74...

output:

100000232 816 -99999770 815
275 100000821 279 -99999188
99999079 -704 -100000923 -702
-650916 -100701 649098 99296
-200926 -150702 199074 149302
-150952 -150709 149052 149292
100000587 -78 -99999415 -71
600 99999929 594 -100000070
99999845 -69 -100000157 -64
-2250167 -150066 2249878 149935
100000568...

result:

ok 18034 cases

Test #41:

score: 0
Accepted
time: 386ms
memory: 3960kb

input:

1334
80
-135 -557
-181 -507
-146 -568
-206 -645
-133 -827
-157 -655
-193 -670
-170 -620
-198 -690
-193 -574
-171 -691
-206 -773
-201 -878
-127 -696
-149 -801
-133 -793
-171 -565
-159 -517
-158 -514
-149 -652
-144 -778
-183 -771
-134 -734
-131 -765
-152 -868
-184 -580
-172 -532
-163 -563
-188 -836
-1...

output:

99999816 -687 -100000185 -693
-1450187 -15950837 1449842 15949479
-400154 -11350849 399860 11349378
-400150 -11350839 399850 11349386
349850 -16300843 -350163 16299488
-250167 -9000696 249844 8999482
-1250162 -1800689 1249863 1799338
-350186 -15650831 349818 15649477
-1400196 -18550877 1399823 18549...

result:

ok 1334 cases

Test #42:

score: 0
Accepted
time: 424ms
memory: 3668kb

input:

1331
50
-140 -1
124 -47
39 10
117 -37
-41 12
-168 14
19 -33
-4 -21
106 -9
-7 -27
108 14
-5 22
-97 3
145 -21
-61 11
94 -42
130 -20
-83 -47
40 3
135 -29
-12 22
-24 -16
-2 -45
-70 18
-67 -13
96 4
214 -6
188 9
-41 -44
155 10
-169 -53
-137 -8
167 -6
-132 -57
-78 -39
148 -19
65 -43
-100 0
140 -49
200 -39
...

output:

99999942 -11 -100000060 -12
-3300081 -3050043 3299993 3050023
-36 -2800046 -39 2800009
-9500005 -2700045 9500193 2700003
-9350023 -1050031 9350162 1049996
-100006 -2450028 99996 2450018
-13300080 -2400040 13300188 2400014
-13300083 -2400042 13300185 2400007
7250128 -1900049 -7250019 1899995
-799972 ...

result:

ok 1331 cases

Test #43:

score: 0
Accepted
time: 444ms
memory: 3664kb

input:

1322
75
368 -861
525 -835
592 -820
542 -812
497 -860
721 -821
243 -812
298 -835
693 -848
834 -845
754 -843
316 -859
62 -850
776 -856
213 -848
-15 -856
789 -840
-98 -837
797 -854
-64 -864
15 -841
578 -843
203 -811
830 -815
155 -844
547 -864
-14 -863
367 -850
70 -844
782 -839
814 -863
238 -819
124 -85...

output:

100000414 -849 -99999591 -838
39950814 -1100864 -39949985 1099161
6400810 -1050867 -6399311 1049162
7400641 -1300864 -7399509 1299152
-17099928 -1800848 17100413 1799193
-15899822 -850863 15900493 849158
-20049877 -1000858 20050528 999166
-30749832 -950855 30750789 949157
-36699935 -850856 36700796 ...

result:

ok 1322 cases

Test #44:

score: 0
Accepted
time: 379ms
memory: 3720kb

input:

1336
52
-478 -109
-473 218
-511 244
-526 -132
-519 -24
-510 -402
-533 -470
-487 -558
-493 -465
-525 -502
-532 35
-529 -485
-509 -299
-501 -226
-529 -483
-511 -352
-520 360
-492 -543
-530 -266
-478 -8
-492 198
-493 -394
-503 20
-532 -492
-502 -556
-479 288
-477 -372
-506 -373
-495 34
-495 -283
-527 3...

output:

99999499 -116 -100000499 -119
-1500533 -24500473 1499502 24500024
-1500530 -24500472 1499491 24500022
399501 -25300463 -400498 25300039
-1250502 -18200221 1249518 18200134
-2450525 -28350431 2449525 28350142
-2800530 -35150484 2799531 35150213
-650490 -24800390 649518 24800107
349523 -30700370 -3504...

result:

ok 1336 cases

Test #45:

score: 0
Accepted
time: 410ms
memory: 3712kb

input:

1343
60
510 -318
-430 -322
526 -292
-2 -324
555 -315
-553 -315
-714 -288
761 -307
133 -320
844 -302
588 -303
-966 -307
226 -317
268 -325
799 -297
830 -292
319 -301
969 -299
-255 -304
225 -299
-632 -325
909 -312
473 -291
197 -295
-453 -285
825 -319
713 -287
-302 -312
-630 -322
-467 -297
254 -290
750 ...

output:

100000410 -308 -99999595 -297
-5850061 -1400325 5850067 1399702
36949940 -1650316 -36950789 1649710
-5850053 -1400320 5850060 1399708
-1399769 -1350314 1400258 1349705
-1399779 -1350317 1400250 1349707
-6249731 -900303 6250386 899708
9500576 -900311 -9499607 899715
-6649424 -900307 6650715 899709
-2...

result:

ok 1343 cases

Test #46:

score: 0
Accepted
time: 343ms
memory: 3716kb

input:

1337
59
-673 67
-695 808
-700 -992
-691 429
-695 7
-686 917
-670 -378
-691 943
-670 542
-668 -202
-684 711
-683 290
-690 -556
-693 -986
-667 -720
-693 -312
-668 -53
-692 -264
-696 634
-664 885
-683 410
-694 -26
-666 33
-686 210
-684 440
-674 990
-666 -243
-662 660
-694 -346
-676 399
-692 -343
-688 -...

output:

99999310 204 -100000688 201
249332 -66700383 -250679 66700959
499329 -32100238 -500673 32100402
649338 -86700897 -650684 86700838
-800696 -40850310 799327 40850503
-950689 -65100316 949321 65100988
-1350690 -38950030 1349343 38950748
-1500693 -50150348 1499340 50150660
549315 -50450743 -550702 50450...

result:

ok 1337 cases

Test #47:

score: 0
Accepted
time: 121ms
memory: 3632kb

input:

18216
2
327 -117
326 -109
6
50 949
52 948
49 955
46 954
51 947
51 954
4
639 -771
644 -774
639 -770
640 -768
9
-340 -785
-343 -779
-340 -779
-343 -787
-344 -782
-342 -788
-341 -785
-348 -781
-347 -781
5
25 522
22 521
17 514
24 516
25 514
7
159 -139
160 -136
163 -145
161 -141
161 -144
157 -144
163 -14...

output:

100000327 -109 -99999671 -112
100000046 952 -99999945 955
150050 -349057 -149949 350957
45 -349059 55 350952
100000641 -774 -99999366 -767
640 -50769 639 49233
99999660 -783 -100000348 -784
299661 -350790 -300346 349220
249661 -350786 -250353 349221
149653 -150781 -150341 149218
-339 99999221 -342 -...

result:

ok 18216 cases

Test #48:

score: 0
Accepted
time: 137ms
memory: 3776kb

input:

18251
3
-317 127
-316 120
-316 128
3
773 790
768 792
776 794
3
235 -643
241 -641
237 -648
4
785 757
779 761
786 759
780 760
2
-274 -493
-271 -491
6
813 -476
816 -473
810 -471
817 -476
819 -473
811 -474
10
-523 -286
-523 -291
-525 -286
-525 -287
-528 -289
-528 -283
-527 -287
-527 -285
-524 -284
-524 ...

output:

99999685 127 -100000313 124
-314 100000130 -319 -99999877
100000771 790 -99999230 791
771 100000788 769 -99999209
100000239 -640 -99999762 -650
242 99999360 239 -100000640
100000779 762 -99999223 757
250779 -149240 -249217 150759
99999733 -496 -100000268 -489
100000812 -476 -99999187 -471
-149188 -1...

result:

ok 18251 cases

Test #49:

score: 0
Accepted
time: 92ms
memory: 3612kb

input:

18071
4
-737 -365
-735 -363
-740 -371
-730 -377
1
-866 -50
4
-505 27
-511 24
-510 28
-516 10
1
969 -299
6
728 665
722 673
729 677
726 682
721 682
722 679
5
493 -818
494 -823
505 -826
503 -815
503 -811
9
-368 580
-370 577
-357 578
-371 570
-360 567
-361 573
-356 569
-363 576
-369 573
3
-972 699
-972 ...

output:

99999263 -364 -100000735 -367
-150741 -300370 149267 299637
100000000 100000000 100000001 100000000
99999494 28 -100000512 21
-550511 -849987 549489 850031
100000000 100000000 100000001 100000000
100000721 680 -99999276 678
150725 -249320 -149279 250678
50719 -449327 -49275 450678
100000495 -819 -99...

result:

ok 18071 cases

Test #50:

score: 0
Accepted
time: 93ms
memory: 3604kb

input:

18145
6
224 514
227 518
222 513
220 525
222 520
226 513
2
829 409
816 403
4
-97 379
-100 372
-86 372
-84 376
10
-248 -150
-239 -154
-244 -148
-250 -155
-253 -150
-247 -162
-242 -154
-251 -162
-253 -161
-243 -161
5
-291 -651
-302 -643
-299 -656
-294 -652
-289 -642
9
-751 642
-755 650
-745 646
-757 64...

output:

100000228 511 -99999779 517
100225 -599485 -99777 600522
100222 -299487 -99778 300525
100000818 410 -99999175 402
99999908 376 -100000097 371
-100090 -199623 99910 200373
99999761 -150 -100000241 -159
-150253 -700167 149755 699846
249753 -550162 -250246 549850
-300254 -350160 299755 349850
-550250 -...

result:

ok 18145 cases

Test #51:

score: 0
Accepted
time: 334ms
memory: 3684kb

input:

2017
21
265 -21
271 12
231 -112
178 -4
300 -59
280 -31
159 -123
168 -105
260 0
283 -43
244 -91
184 -85
251 9
184 -32
194 24
308 -105
303 -26
298 -39
222 -38
262 -40
304 -45
60
20 -24
-78 -29
43 9
19 -98
-95 -102
-15 13
-86 -153
-28 -143
-36 -131
-29 8
2 -84
-119 -54
61 -111
45 -118
4 -9
-49 -155
-68...

output:

100000282 -45 -99999723 -34
-149696 -1650063 150298 1649972
2400307 -5250107 -2399735 5249997
-5599838 -3700104 5600276 3699965
-499832 -5050105 500179 5049998
-799756 -4550092 800254 4549999
1750298 -1900056 -1749735 1899981
-799833 -3650111 800179 3649967
198 99999966 208 -100000032
287 99999970 2...

result:

ok 2017 cases

Test #52:

score: 0
Accepted
time: 351ms
memory: 3684kb

input:

2004
51
-599 848
-581 868
-649 798
-539 847
-696 853
-560 959
-646 886
-617 835
-564 886
-688 920
-517 891
-567 935
-547 834
-639 907
-525 910
-685 914
-558 913
-565 896
-669 891
-619 789
-524 841
-613 878
-626 881
-611 824
-671 842
-675 887
-624 912
-658 937
-647 868
-654 821
-637 914
-655 865
-657...

output:

99999344 878 -100000654 875
-5650671 -6149167 5649438 6150961
-4200606 -4899206 4199479 4900890
-1150653 -5249164 1149366 5250949
-2850621 -6199162 2849442 6200959
-2500613 -4999160 2499435 5000938
-1800597 -5149211 1799430 5150894
-400573 -3249181 399441 3250883
349476 -2649142 -350529 2650906
-225...

result:

ok 2004 cases

Test #53:

score: 0
Accepted
time: 330ms
memory: 3776kb

input:

1948
55
166 885
178 909
158 887
127 910
130 872
128 898
185 896
150 916
116 906
168 865
133 875
142 924
169 894
131 911
146 885
176 884
174 900
191 895
158 862
155 888
146 923
175 872
162 901
180 900
136 870
130 870
165 917
137 905
134 925
133 882
149 898
191 907
169 882
173 895
124 889
166 894
165 ...

output:

100000180 896 -99999822 895
-2749862 -1849128 2750186 1850903
-1399864 -2499128 1400163 2500915
-799869 -1149124 800150 1150897
141 -1899138 140 1900900
700169 -2399141 -699843 2400913
550174 -2799136 -549844 2800917
-3349872 -899113 3350193 900907
250178 -2699128 -249822 2700934
-899839 -2999136 90...

result:

ok 1948 cases

Test #54:

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

input:

100000
1
251 -713
1
-567 -343
1
399 424
1
137 528
1
48 389
1
-343 290
1
-56 -915
1
722 -144
1
-71 -808
1
222 895
1
922 -299
1
139 617
1
320 -944
1
914 659
1
-1 -406
1
-136 672
1
534 79
1
-560 -60
1
-349 398
1
-622 139
1
343 549
1
-451 719
1
690 -154
1
-329 433
1
175 -501
1
-959 116
1
-283 872
1
-198...

output:

100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 100000001 100000000
100000000 100000000 ...

result:

ok 100000 cases

Test #55:

score: 0
Accepted
time: 499ms
memory: 3700kb

input:

1000
100
796 933
646 825
799 894
831 952
716 839
821 958
664 918
679 955
741 916
777 930
719 828
795 794
690 975
815 821
829 880
816 814
710 922
737 923
790 974
766 925
719 853
795 854
800 853
730 818
761 802
706 830
817 874
730 991
676 818
822 821
783 882
756 877
818 969
641 912
734 847
833 980
811...

output:

100000700 895 -99999301 889
6850820 -7599187 -6849320 7600965
6850809 -7599181 -6849321 7600962
-99190 -7899192 100822 7900970
-1749200 -4999149 1750832 5000957
-3299246 -3999108 3300813 4000966
7050783 -499117 -7049358 500892
7200785 -2249124 -7199361 2250926
750734 -3749184 -749287 3750893
-259928...

result:

ok 1000 cases

Test #56:

score: 0
Accepted
time: 522ms
memory: 3940kb

input:

1000
100
130 -309
152 -215
174 -362
191 -281
120 -315
230 -321
120 -235
190 -336
152 -347
220 -374
221 -372
131 -261
203 -244
176 -245
181 -378
170 -381
190 -374
208 -378
149 -347
172 -246
172 -295
183 -265
142 -311
147 -384
214 -303
102 -240
91 -328
191 -382
127 -327
164 -312
184 -383
194 -212
165 ...

output:

100000263 -306 -99999733 -308
-1999829 -9300391 2000210 9299792
250190 -2650338 -249821 2649722
2100178 -5050391 -2099871 5049710
900165 -8300385 -899850 8299783
-1749868 -6350338 1750162 6349784
-4349883 -6000360 4350206 5999766
-4649882 -5400314 4650210 5399792
-3199871 -3050342 3200186 3049721
-1...

result:

ok 1000 cases

Test #57:

score: 0
Accepted
time: 416ms
memory: 3940kb

input:

1000
100
-909 -612
-150 -821
-398 -606
-907 172
118 -960
-720 509
757 -436
-209 680
-186 786
-551 -316
-700 -788
-536 -24
563 -180
613 -561
-70 97
-278 448
54 -25
527 -376
-86 583
-621 -915
-519 506
686 478
296 502
-587 604
-820 962
357 -553
-565 569
-666 311
-61 365
109 302
533 138
401 -51
202 906
...

output:

100000228 -34 -99999770 -37
-13800998 -67250842 13799283 67250514
-9350695 -65350786 9349485 65350521
-89550914 -72250616 89550880 72250831
-31999906 -68350538 32000739 68350838
-13099397 -79100700 13100873 79100875
66650616 -53500566 -66650716 53500505
71350603 -83250698 -71350822 83250961
54650585...

result:

ok 1000 cases

Test #58:

score: 0
Accepted
time: 418ms
memory: 3740kb

input:

1000
100
488 -596
-284 -300
788 -42
732 404
600 -392
-47 -491
870 69
229 193
536 -486
-328 141
172 936
201 -950
-141 -260
28 -938
-730 -220
317 -778
50 -706
139 -546
-153 -909
285 -710
399 182
141 431
-735 407
-209 -336
676 -412
696 11
723 672
-398 -853
-567 159
-577 119
103 107
128 195
486 -643
379...

output:

100000207 -4 -99999791 -7
33050320 -75450780 -33050350 75450733
-33849687 -42100783 33850991 42100069
-18649478 -41600530 18650892 41600304
33050317 -75450782 -33050339 75450736
39250046 -55650703 -39250731 55650403
49300055 -52200702 -49300939 52200340
49300045 -52200702 -49300936 52200337
54500357...

result:

ok 1000 cases

Test #59:

score: 0
Accepted
time: 101ms
memory: 3596kb

input:

18155
5
951 -151
947 -165
949 -160
944 -174
945 -153
9
849 243
847 221
842 254
842 233
844 252
843 252
845 242
847 256
846 242
6
939 -893
942 -859
947 -876
942 -873
943 -865
940 -859
6
-801 -542
-805 -555
-800 -537
-800 -536
-804 -548
-803 -543
3
-133 369
-131 344
-136 375
8
141 725
140 714
140 723
...

output:

100000947 -161 -99999048 -168
-99052 -250165 100948 249840
948 99999845 947 -100000157
100000842 238 -99999151 247
839 -1049771 847 1050255
250844 -1649783 -249154 1650258
-49154 -699754 50846 700261
850 100000246 847 -99999746
100000942 -875 -99999060 -864
-149064 -1700898 150945 1699135
100943 -70...

result:

ok 18155 cases

Test #60:

score: 0
Accepted
time: 99ms
memory: 3664kb

input:

18124
3
442 83
467 83
436 82
5
-842 705
-858 703
-820 700
-841 703
-848 699
3
187 -959
202 -955
197 -959
3
119 865
115 871
103 866
7
-369 255
-372 256
-364 253
-383 254
-357 254
-368 252
-379 249
10
-680 800
-667 803
-655 802
-660 805
-658 797
-682 801
-663 805
-686 797
-660 803
-679 801
10
-179 -39...

output:

100000452 83 -99999550 82
454 100000080 453 -99999922
99999165 697 -100000828 706
1099185 -249302 -1100840 250702
-847 100000700 -850 -99999292
100000197 -957 -99999810 -961
197 99999039 196 -100000957
100000112 867 -99999884 864
114 100000862 105 -99999128
99999639 256 -100000363 251
249638 -99746 ...

result:

ok 18124 cases

Test #61:

score: 0
Accepted
time: 106ms
memory: 3896kb

input:

18208
6
-329 815
-331 816
-330 821
-329 787
-330 750
-328 840
1
-183 613
8
-630 492
-630 539
-634 498
-634 538
-633 505
-631 474
-633 498
-632 549
8
-608 664
-610 672
-611 674
-609 710
-607 723
-608 700
-609 655
-610 639
9
271 -648
272 -688
268 -663
268 -672
270 -650
272 -703
270 -726
269 -735
271 -...

output:

99999671 816 -100000331 815
-328 -3549253 -331 3550826
49665 -299189 -50325 300816
100000000 100000000 100000001 100000000
99999363 498 -100000638 506
-634 -1999506 -629 2000543
99368 -2849509 -100632 2850554
-636 -1999497 -630 2000542
99999394 672 -100000616 675
-50607 -2949331 49392 2950721
-50609...

result:

ok 18208 cases

Test #62:

score: 0
Accepted
time: 106ms
memory: 3616kb

input:

18128
5
-53 636
-74 635
-27 633
-22 633
-79 635
2
-359 -546
-350 -545
5
548 -680
535 -676
505 -676
533 -679
499 -680
9
781 -432
732 -431
764 -435
816 -435
786 -432
819 -433
750 -434
740 -431
825 -434
1
-717 311
10
-13 -742
-35 -744
-46 -743
-64 -744
-43 -742
-78 -743
-52 -740
-7 -740
-29 -741
-60 -7...

output:

99999944 634 -100000052 632
1299974 -149367 -1300054 150636
-76 100000632 -77 -99999370
99999646 -546 -100000350 -544
100000515 -675 -99999481 -684
-299496 -200683 300503 199327
535 99999328 534 -100000675
100000786 -428 -99999217 -439
-149190 -100432 150815 99561
4250826 -150432 -4249264 149567
500...

result:

ok 18128 cases

Test #63:

score: 0
Accepted
time: 400ms
memory: 3888kb

input:

1327
81
-908 -105
-896 -203
-892 -384
-962 -1
-906 -122
-959 -219
-923 -287
-953 -123
-899 -165
-959 -33
-928 0
-904 -79
-918 -115
-938 -198
-916 -318
-890 -205
-953 -48
-954 -52
-930 -96
-933 -95
-890 -329
-917 -162
-952 -9
-892 -356
-930 -239
-952 8
-960 -102
-920 -73
-901 -57
-924 -254
-887 -344
...

output:

99999086 -163 -100000910 -165
49107 -12500300 -50890 12499943
-952 -12150253 -953 12149993
849064 -11950383 -850952 11949850
3249110 -9850206 -3250961 9849991
99108 -14900301 -100884 14899999
-3600959 -14700346 3599111 14699947
949099 -8700215 -950925 8699954
-300921 -9450287 299081 9449902
649100 -...

result:

ok 1327 cases

Test #64:

score: 0
Accepted
time: 429ms
memory: 3656kb

input:

1323
65
609 648
236 690
403 661
293 657
347 643
475 636
551 669
506 663
358 679
595 710
550 671
610 660
318 712
563 653
260 700
558 698
423 710
275 685
541 638
232 638
573 656
608 689
281 681
510 639
353 639
375 704
370 661
403 681
591 707
429 689
284 660
219 642
522 698
247 706
469 696
387 654
447 ...

output:

100000544 670 -99999452 668
-5699529 -3649361 5700588 3650703
-5399520 -1999367 5400585 2000678
700611 -3099355 -699407 3100712
-1199438 -3099354 1200587 3100706
11350474 -2299364 -11349746 2300678
-5349617 -2049343 5350496 2050695
5300381 -1349341 -5299717 1350678
-2449774 -2149361 2450276 2150686
...

result:

ok 1323 cases

Test #65:

score: 0
Accepted
time: 437ms
memory: 3964kb

input:

1326
62
184 322
570 339
862 364
549 368
688 367
144 337
599 334
221 375
839 353
371 331
373 332
363 348
506 321
744 373
803 356
396 362
101 325
-96 345
81 353
736 355
541 349
484 321
315 374
118 327
77 377
604 341
-73 370
330 345
862 365
827 330
845 371
528 372
555 361
575 363
877 344
97 346
168 337...

output:

100000463 356 -99999538 350
33150826 -2499668 -33149842 2500377
33150830 -2499669 -33149834 2500381
-13000102 -1749658 13000167 1750379
20800368 -1949665 -20800048 1950371
12050162 -1649664 -12050072 1650374
-19749849 -1749663 19750551 1750367
-19199857 -1749662 19200533 1750374
16200850 -1949668 -1...

result:

ok 1326 cases

Test #66:

score: 0
Accepted
time: 382ms
memory: 3660kb

input:

1345
52
119 309
160 -70
166 504
130 499
107 531
118 0
143 159
143 196
111 455
158 358
115 264
163 -266
151 -332
146 -15
141 364
129 -375
127 -83
113 188
129 384
115 546
145 -215
147 -412
132 225
126 -18
146 -11
165 -45
141 427
152 312
161 267
110 -27
127 186
118 18
142 86
134 -343
131 309
157 -131
1...

output:

100000137 171 -99999861 168
750156 -22700126 -749860 22700328
2100159 -19750130 -2099887 19750265
1550162 -24550270 -1549863 24550229
2050154 -15449854 -2049893 15450460
650139 -22000219 -649867 22000223
250148 -22100019 -249861 22100425
-699876 -22350088 700146 22350366
950134 -30350346 -949885 303...

result:

ok 1345 cases

Test #67:

score: 0
Accepted
time: 415ms
memory: 3912kb

input:

1336
66
75 -674
-467 -646
-496 -660
224 -639
-25 -645
-208 -639
-443 -644
-705 -652
-983 -657
796 -651
-921 -670
851 -656
-806 -668
-517 -656
-685 -644
-974 -667
-343 -654
608 -661
-462 -667
-396 -637
847 -641
270 -658
712 -641
268 -650
-487 -661
-106 -643
919 -657
321 -650
235 -665
792 -649
-322 -6...

output:

100000170 -653 -99999831 -659
3950924 -300659 -3949158 299346
-18550767 -1250666 18549599 1249364
31350848 -850660 -31349781 849363
31950533 -1400669 -31950107 1399355
44800686 -1250667 -44800210 1249364
-15349467 -1000671 15350845 999352
33799928 -1600672 -33800746 1599354
17299955 -1750677 -173003...

result:

ok 1336 cases

Test #68:

score: 0
Accepted
time: 348ms
memory: 3700kb

input:

1331
82
-548 252
-547 -566
-562 954
-526 -25
-562 -755
-528 -719
-554 -798
-528 578
-535 120
-534 37
-529 861
-563 910
-542 -407
-539 -711
-532 189
-536 65
-563 429
-541 -590
-540 -936
-526 -848
-559 157
-537 367
-553 333
-544 -873
-541 -152
-558 452
-550 427
-555 827
-561 900
-560 26
-544 482
-523 ...

output:

99999450 66 -100000546 64
49439 -53700617 -50554 53700455
799450 -86700986 -800556 86700741
299449 -94850949 -300566 94850958
-50563 -82750753 49440 82750895
-800556 -22799972 799452 22800477
49458 -69300902 -50544 69300485
49451 -69300905 -50545 69300486
-50547 -48350082 49457 48350881
-300542 -571...

result:

ok 1331 cases