QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208911#5155. Faster Than LightJooDdaeWA 192ms35824kbC++202.7kb2023-10-09 22:01:222023-10-09 22:01:22

Judging History

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

  • [2023-10-09 22:01:22]
  • 评测
  • 测评结果:WA
  • 用时:192ms
  • 内存:35824kb
  • [2023-10-09 22:01:22]
  • 提交

answer

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

struct point {
    ll x, y;

    bool operator < (const point &o) const {
        return tie(x, y) < tie(o.x, o.y);
    }
    point operator - (const point &a)const{
        return {x-a.x, y-a.y};
    }
};

ll cross(point a, point b){
    return a.x * b.y - a.y * b.x;
}

int ccw(point a, point b, point c){
    auto re = cross(b-a, c-a);
    return (re > 0) - (re < 0);
}

bool solve(vector<array<point, 2>> p) {
    vector<point> X, Y, dh, uh;
    for(auto [x, y] : p) X.push_back(x), Y.push_back(y);


    swap(*min_element(X.begin(), X.end()), X[0]);
    sort(X.begin()+1, X.end(), [&](auto a, auto b){
        auto re = ccw(X[0], a, b);
        return re ? re < 0 : tie(a.x, a.y) < tie(b.x, b.y);
    });
    // reverse(X.begin()+1, X.end());

    for(auto p : X) {
        // cout << p.x << " " << p.y << "\n";
        while(dh.size() > 1 && ccw(dh[dh.size()-2], dh.back(), p) >= 0) dh.pop_back();
        dh.push_back(p);
    }



    swap(*min_element(Y.begin(), Y.end(), [&](auto a, auto b){ return tie(a.x, b.y) < tie(b.x, a.y); }), Y[0]);
    sort(Y.begin()+1, Y.end(), [&](auto a, auto b){
        auto re = ccw(Y[0], a, b);
        return re ? re > 0 : tie(a.x, b.y) < tie(b.x, a.y);
    });

    for(auto p : Y) {
        // cout << p.x << " " << p.y << "\n";
        while(uh.size() > 1 && ccw(uh[uh.size()-2], uh.back(), p) <= 0) uh.pop_back();
        uh.push_back(p);
    }

    // for(int i=0;i+1<dh.size();i++) cout << dh[i].x << " " << dh[i].y << " " << dh[i+1].x << " " << dh[i+1].y << "\n";
    // cout << "----------------------------------\n";
    // for(int i=0;i+1<uh.size();i++) cout << uh[i].x << " " << uh[i].y << " " << uh[i+1].x << " " << uh[i+1].y << "\n";
    // cout << "\n";


    for(int i=0, j=0;i+1<dh.size();i++) {
        while(j < uh.size() && uh[j].x <= dh[i+1].x) {
            if(ccw(dh[i], dh[i+1], uh[j]) < 0) return false;
            j++;
        }
    }

    for(int i=0, j=0;i+1<uh.size();i++) {
        while(j < dh.size() && dh[j].x <= uh[i+1].x) {
            if(ccw(uh[i], uh[i+1], dh[j]) > 0) return false;
            j++;
        }
    }

    return true;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;

    vector<array<point, 2>> p(n);
    for(auto &[p1, p2] : p) {
        cin >> p1.x >> p1.y;
        cin >> p2.x >> p2.y;
    }
    if(solve(p)) return cout << "possible", 0;

    for(auto &[p1, p2] : p) swap(p1.x, p2.x);
    if(solve(p)) return cout << "possible", 0;

    for(auto &[p1, p2] : p) swap(p1.x, p2.x), swap(p1.x, p1.y), swap(p2.x, p2.y);
    cout << (solve(p) ? "possible" : "impossible");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3444kb

input:

5
1 3 3 4
2 2 4 3
4 1 5 3
5 2 7 3
6 3 8 4

output:

possible

result:

ok single line: 'possible'

Test #2:

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

input:

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

output:

impossible

result:

ok single line: 'impossible'

Test #3:

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

input:

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

output:

possible

result:

ok single line: 'possible'

Test #4:

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

input:

5
0 0 1 999999999
0 999999999 999999999 1000000000
1 0 999999998 1
999999998 0 999999999 999999999
2 999999998 3 999999999

output:

impossible

result:

ok single line: 'impossible'

Test #5:

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

input:

4
0 1 1 1000000000
1 0 999999999 1
999999999 0 1000000000 999999999
2 999999999 999999999 1000000000

output:

possible

result:

ok single line: 'possible'

Test #6:

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

input:

3
0 0 1 1000000000
2 0 999999999 1
2 999999999 999999999 1000000000

output:

impossible

result:

ok single line: 'impossible'

Test #7:

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

input:

3
0 0 1 1000000000
2 0 999999999 1
2 999999999 1000000000 1000000000

output:

possible

result:

ok single line: 'possible'

Test #8:

score: 0
Accepted
time: 167ms
memory: 28724kb

input:

199999
433914929 216935871 433914930 216935872
621822279 310889546 621822280 310889547
395914333 197935573 395914334 197935574
582775641 291366227 582775642 291366228
658726133 329341473 658726134 329341474
71689261 35823037 71689262 35823038
453260967 226608890 453260968 226608891
249802825 1248798...

output:

impossible

result:

ok single line: 'impossible'

Test #9:

score: 0
Accepted
time: 184ms
memory: 28148kb

input:

199999
783545903 638444708 783545904 638444709
129510863 105527268 129510864 105527269
844145756 687822366 844145757 687822367
69111161 56312696 69111162 56312697
820438487 668505332 820438488 668505333
541037357 440845152 541037358 440845153
201057677 163824672 201057678 163824673
132372296 1078588...

output:

impossible

result:

ok single line: 'impossible'

Test #10:

score: 0
Accepted
time: 166ms
memory: 27428kb

input:

199999
90035476 60020102 90035477 60020103
482291029 321523804 482291030 321523805
943496815 628994328 943496816 628994329
278866936 185907742 278866937 185907743
310938589 207288844 310938590 207288845
203677765 135781628 203677766 135781629
368744134 245825874 368744135 245825875
559390024 3729231...

output:

impossible

result:

ok single line: 'impossible'

Test #11:

score: 0
Accepted
time: 171ms
memory: 27356kb

input:

199999
207687261 415417709 207687262 415417710
150460947 300965081 150460948 300965082
9349830 18742847 9349831 18742848
87879837 175802861 87879838 175802862
354035800 708114787 354035801 708114788
305159254 610361695 305159255 610361696
248609913 497263013 248609914 497263014
499646110 999335407 4...

output:

impossible

result:

ok single line: 'impossible'

Test #12:

score: 0
Accepted
time: 170ms
memory: 27380kb

input:

199999
79738802 97861382 79738803 97861383
614827422 754561052 614827423 754561053
517213290 634761890 517213291 634761891
788424494 967612004 788424495 967612005
613541698 752983118 613541699 752983119
698980304 857839589 698980305 857839590
487475098 598265018 487475099 598265019
733711836 9004646...

output:

impossible

result:

ok single line: 'impossible'

Test #13:

score: 0
Accepted
time: 165ms
memory: 27372kb

input:

199999
161399962 242105266 161399963 242105267
385751852 578633101 385751853 578633102
222705450 334063498 222705451 334063499
503730932 755601721 503730933 755601722
454037530 681061618 454037531 681061619
334605270 501913228 334605271 501913229
478675624 718018759 478675625 718018760
137316204 205...

output:

impossible

result:

ok single line: 'impossible'

Test #14:

score: 0
Accepted
time: 188ms
memory: 28216kb

input:

199999
222639792 110935680 222639793 110935683
931931336 465581452 931931337 465581455
35474718 17353143 35474719 17353146
206777070 103004319 206777071 103004322
914064786 456648177 914064787 456648180
301496196 150363882 301496197 150363885
515345552 257288560 515345553 257288563
500949336 2500904...

output:

impossible

result:

ok single line: 'impossible'

Test #15:

score: 0
Accepted
time: 191ms
memory: 28976kb

input:

199999
14166026 11542586 14166027 11542589
212205815 172908340 212205816 172908343
997392464 812690054 997392465 812690057
766610585 624645560 766610586 624645563
843092432 686964102 843092433 686964105
362333537 295234632 362333538 295234635
724513967 590344612 724513968 590344615
903878693 7364936...

output:

impossible

result:

ok single line: 'impossible'

Test #16:

score: 0
Accepted
time: 171ms
memory: 27424kb

input:

199999
259728590 173148768 259728591 173148771
221053226 147365192 221053227 147365195
899826680 599880828 899826681 599880831
847582532 565051396 847582533 565051399
258078974 172049024 258078975 172049027
369519293 246342570 369519294 246342573
214263539 142838734 214263540 142838737
737461550 491...

output:

impossible

result:

ok single line: 'impossible'

Test #17:

score: 0
Accepted
time: 171ms
memory: 27428kb

input:

199999
310634507 622037446 310634510 622037447
14947597 30663626 14947600 30663627
99728538 200225508 99728541 200225509
184650291 370069014 184650294 370069015
166422010 333612452 166422013 333612453
302228792 605226016 302228795 605226017
386996090 774760612 386996093 774760613
326681088 654130608...

output:

impossible

result:

ok single line: 'impossible'

Test #18:

score: 0
Accepted
time: 177ms
memory: 27696kb

input:

199999
799006978 980599598 799006981 980599599
101833006 124976996 101833009 124976997
491420512 603107117 491420515 603107118
529582438 649942208 529582441 649942209
453375406 556415396 453375409 556415397
591719612 726201467 591719615 726201468
775042202 951188282 775042205 951188283
218921560 268...

output:

impossible

result:

ok single line: 'impossible'

Test #19:

score: 0
Accepted
time: 172ms
memory: 27424kb

input:

199999
354595980 531899408 354595983 531899409
57294868 85947740 57294871 85947741
297914740 446877548 297914743 446877549
306592118 459893615 306592121 459893616
648745732 973124036 648745735 973124037
267426974 401145899 267426977 401145900
363073104 544615094 363073107 544615095
512209740 7683200...

output:

impossible

result:

ok single line: 'impossible'

Test #20:

score: 0
Accepted
time: 85ms
memory: 24076kb

input:

200000
183486 13299 183487 13300
102571 78692 102572 78693
170699 23633 170700 23634
62500 111076 62501 111077
175314 19903 175315 19904
147075 42725 147076 42726
131050 55675 131051 55676
165234 28050 165235 28051
98541 81949 98542 81950
186747 10663 186748 10664
128558 57690 128559 57691
75090 100...

output:

possible

result:

ok single line: 'possible'

Test #21:

score: 0
Accepted
time: 173ms
memory: 27356kb

input:

200000
84832 76958 84833 76959
10067 59201 10068 59202
59229 70877 59230 70878
106141 82019 106142 82020
89100 77971 89101 77972
107123 82252 107124 82253
29040 63708 29041 63709
174481 98249 174482 98250
149793 92386 149794 92387
31435 64276 31436 64277
152941 93133 152942 93134
112041 83420 112042...

output:

impossible

result:

ok single line: 'impossible'

Test #22:

score: 0
Accepted
time: 172ms
memory: 27352kb

input:

200000
44135 36736 44136 36737
89083 45138 89084 45139
71165 41788 71166 41789
68851 41356 68852 41357
94251 46104 94252 46105
24076 32986 24077 32987
75127 42529 75128 42530
21105 32431 21106 32432
97018 46621 97019 46622
100975 47361 100976 47362
122230 51334 122231 51335
131723 53109 131724 53110...

output:

impossible

result:

ok single line: 'impossible'

Test #23:

score: 0
Accepted
time: 87ms
memory: 24588kb

input:

200000
12123595 65272337 12123596 65272338
47819779 50226819 47819780 50226820
34587193 55804197 34587194 55804198
31014123 57310204 31014124 57310205
55526647 46978466 55526648 46978467
63405174 43657760 63405175 43657761
92658071 31328012 92658072 31328013
69459554 41105911 69459555 41105912
13473...

output:

possible

result:

ok single line: 'possible'

Test #24:

score: 0
Accepted
time: 183ms
memory: 27408kb

input:

200000
25587435 13688997 25587436 13688998
67822058 7043790 67822059 7043791
50756536 9728884 50756537 9728885
50605565 9752638 50605566 9752639
948172 17565746 948173 17565747
99155430 2113788 99155431 2113789
2457571 17328257 2457572 17328258
55236107 9024067 55236108 9024068
6859008 16635734 6859...

output:

impossible

result:

ok single line: 'impossible'

Test #25:

score: 0
Accepted
time: 169ms
memory: 27348kb

input:

200000
308 141674 309 141675
30411 124142 30412 124143
26864 126208 26865 126209
153801 52285 153802 52286
90521 89137 90522 89138
159641 48883 159642 48884
188626 32004 188627 32005
22527 128734 22528 128735
132574 64646 132575 64647
45592 115301 45593 115302
47431 114231 47432 114232
173312 40922 ...

output:

impossible

result:

ok single line: 'impossible'

Test #26:

score: 0
Accepted
time: 76ms
memory: 22816kb

input:

200000
56156 97395 56157 97396
75189 41275 75190 41276
87911 3766 87912 3767
50380 114426 50381 114427
34447 161405 34448 161406
45750 128079 45751 128080
36895 154185 36896 154186
82967 18345 82968 18346
83297 17369 83298 17370
50841 113065 50842 113066
61613 81307 61614 81308
81748 21939 81749 219...

output:

possible

result:

ok single line: 'possible'

Test #27:

score: 0
Accepted
time: 186ms
memory: 29196kb

input:

200000
110235 130882 110236 130883
132712 187597 132713 187598
94392 90907 94393 90908
81558 58524 81559 58525
59674 3306 59675 3307
61359 7558 61360 7559
133389 189304 133390 189305
120581 156987 120582 156988
129825 180310 129826 180311
84642 66306 84643 66307
112281 136044 112282 136045
67009 218...

output:

impossible

result:

ok single line: 'impossible'

Test #28:

score: 0
Accepted
time: 171ms
memory: 28992kb

input:

200000
140230 53637 140231 53638
142915 28531 142916 28532
137051 83364 137052 83365
141400 42696 141401 42697
144324 15354 144325 15355
128421 164046 128422 164047
126285 184020 126286 184021
141765 39283 141766 39284
136961 84199 136962 84200
142007 37021 142008 37022
137086 83034 137087 83035
128...

output:

impossible

result:

ok single line: 'impossible'

Test #29:

score: 0
Accepted
time: 192ms
memory: 27336kb

input:

200000
55205759 10901341 55205760 10901342
60674231 25887846 60674232 25887847
78521510 74798826 78521511 74798827
58210191 19135073 58210192 19135074
53049049 4990815 53049050 4990816
78791227 75537993 78791228 75537994
80659297 80657493 80659298 80657494
82535491 85799256 82535492 85799257
7105544...

output:

impossible

result:

ok single line: 'impossible'

Test #30:

score: 0
Accepted
time: 177ms
memory: 28128kb

input:

200000
69507066 51970715 69507067 51970716
86474964 98135774 86474965 98135775
67094841 45407702 67094842 45407703
75120388 67243045 75120389 67243046
80620577 82207570 80620578 82207571
58416570 21796476 58416571 21796477
77617864 74038000 77617865 74038001
61095812 29085968 61095813 29085969
70495...

output:

impossible

result:

ok single line: 'impossible'

Test #31:

score: 0
Accepted
time: 180ms
memory: 27360kb

input:

200000
115996 107127 115997 107128
130561 66339 130562 66340
145545 24378 145546 24379
123364 86492 123365 86493
136600 49428 136601 49429
94939 166093 94940 166094
95551 164379 95552 164380
109878 124258 109879 124259
149367 13674 149368 13675
142089 34056 142090 34057
145354 24913 145355 24914
127...

output:

impossible

result:

ok single line: 'impossible'

Test #32:

score: 0
Accepted
time: 79ms
memory: 32000kb

input:

200000
540875748 213117203 540875749 285258332
573214234 160023435 573214235 273675128
280235458 508389718 280235459 511266397
554777064 193046152 554777065 277526751
83500104 657941433 83500105 755185390
318772782 471268854 318772783 471312613
442363064 337243144 442363065 358157759
567076494 17302...

output:

possible

result:

ok single line: 'possible'

Test #33:

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

input:

200000
545890204 660412901 545890205 733622540
355932631 487259674 355932632 526860621
365752045 501577171 365752046 532181952
456664249 606624304 456664250 608959227
424878061 575575020 424878062 576436135
514307716 647550525 514307717 683319940
377023151 517310122 377023152 538991213
512010801 646...

output:

possible

result:

ok single line: 'possible'

Test #34:

score: 0
Accepted
time: 170ms
memory: 28924kb

input:

200000
559500610 182638644 559500611 1000000000
704740648 124658392 704740649 1000000000
453884146 216066318 453884147 1000000000
653356372 146762800 653356373 1000000000
848640316 52892288 848640317 1000000000
729790066 113246252 729790067 1000000000
184813732 264602196 184813733 1000000000
2128339...

output:

impossible

result:

ok single line: 'impossible'

Test #35:

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

input:

200000
844231074 264768268 844231075 1000000000
374772666 721808706 374772667 1000000000
369781098 719530572 369781099 1000000000
838236438 273350001 838236439 1000000000
469648506 661772182 469648507 1000000000
808973086 312607291 808973087 1000000000
418704886 699113858 418704887 1000000000
380966...

output:

possible

result:

ok single line: 'possible'

Test #36:

score: 0
Accepted
time: 89ms
memory: 33032kb

input:

200000
831659756 530292347 856949803 530292348
780834823 657223277 780843806 657223278
851668992 442238633 924994281 442238634
791449831 635090613 792361462 635090614
648550894 860906231 709444781 860906232
643939165 866436297 708526444 866436298
623751051 888742123 706408732 888742124
785915669 646...

output:

possible

result:

ok single line: 'possible'

Test #37:

score: 0
Accepted
time: 139ms
memory: 35824kb

input:

200000
686943822 697288271 701366401 697288272
710834127 861997619 759830770 861997620
709289636 998940135 829846519 998940136
526699374 130592131 578262779 130592132
516166309 104229307 575614432 104229308
650133293 521513355 650289472 521513356
540398262 166343843 582439747 166343844
661998408 572...

output:

possible

result:

ok single line: 'possible'

Test #38:

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

input:

200000
556378024 702290569 1000000000 702290570
375383152 519806407 1000000000 519806408
47917112 238326199 1000000000 238326200
566511597 713213227 1000000000 713213228
753546817 935797585 1000000000 935797586
770625277 969716995 1000000000 969716996
733522652 908465515 1000000000 908465516
7687380...

output:

possible

result:

ok single line: 'possible'

Test #39:

score: 0
Accepted
time: 160ms
memory: 28972kb

input:

200000
506610310 652006679 1000000000 652006680
730959611 234589139 1000000000 234589140
400728590 793871621 1000000000 793871622
254808340 961013447 1000000000 961013448
354741032 850465895 1000000000 850465896
672532854 378656303 1000000000 378656304
550408527 587256803 1000000000 587256804
724112...

output:

impossible

result:

ok single line: 'impossible'

Test #40:

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

input:

3
1 4 2 5
2 3 3 4
3 4 4 5

output:

possible

result:

ok single line: 'possible'

Test #41:

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

input:

3
1 5 2 6
3 1 4 2
2 4 3 5

output:

possible

result:

ok single line: 'possible'

Test #42:

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

input:

15
1 1 2 5
2 1 3 6
3 1 4 7
4 1 5 8
5 1 6 9
6 3 7 9
7 4 8 9
8 5 9 10
9 4 10 9
10 3 11 9
11 1 12 9
12 1 13 8
13 1 14 7
14 1 15 6
15 1 16 5

output:

possible

result:

ok single line: 'possible'

Test #43:

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

input:

3
1 1 2 2
9999999 9999998 10000000 9999999
9999998 9999996 9999999 9999997

output:

possible

result:

ok single line: 'possible'

Test #44:

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

input:

3
1 1 2 2
9999998 9999998 9999999 9999999
9999997 9999996 9999998 9999997

output:

possible

result:

ok single line: 'possible'

Test #45:

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

input:

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

output:

possible

result:

ok single line: 'possible'

Test #46:

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

input:

5
1 2 2 3
2 1 3 2
999999997 999999997 999999998 999999998
999999998 999999996 999999999 999999997
999999997 999999995 999999998 999999996

output:

impossible

result:

ok single line: 'impossible'

Test #47:

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

input:

5
1 2 2 3
2 1 3 2
999999996 999999995 999999997 999999996
999999997 999999994 999999998 999999995
499999999 499999997 500000000 499999998

output:

impossible

result:

ok single line: 'impossible'

Test #48:

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

input:

5
1 2 2 3
2 1 3 2
999999996 999999995 999999997 999999996
999999997 999999994 999999998 999999995
499999998 499999998 499999999 499999999

output:

possible

result:

ok single line: 'possible'

Test #49:

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

input:

5
999999997 2 999999998 3
999999996 1 999999997 2
2 999999995 3 999999996
1 999999994 2 999999995
500000000 499999998 500000001 499999999

output:

possible

result:

ok single line: 'possible'

Test #50:

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

input:

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

output:

possible

result:

ok single line: 'possible'

Test #51:

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

input:

4
2 1 3 2
1 2 2 3
3 4 4 5
4 3 5 4

output:

possible

result:

ok single line: 'possible'

Test #52:

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

input:

4
3 1 4 2
4 2 5 3
2 4 3 5
1 3 2 4

output:

possible

result:

ok single line: 'possible'

Test #53:

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

input:

5
2 1 3 2
1 2 2 3
3 4 4 5
4 3 5 4
2 2 4 4

output:

possible

result:

ok single line: 'possible'

Test #54:

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

input:

5
3 1 4 2
4 2 5 3
2 4 3 5
1 3 2 4
2 2 4 4

output:

possible

result:

ok single line: 'possible'

Test #55:

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

input:

6
1 1 2 2
2 2 3 3
3 3 4 4
2 1 3 2
3 2 4 3
3 1 4 2

output:

possible

result:

ok single line: 'possible'

Test #56:

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

input:

6
3 1 4 2
2 2 3 3
1 3 2 4
2 1 3 2
1 2 2 3
1 1 2 2

output:

possible

result:

ok single line: 'possible'

Test #57:

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

input:

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

output:

possible

result:

ok single line: 'possible'

Test #58:

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

input:

5
1 1 3 2
3 1 4 3
1 2 2 4
2 3 4 4
2 2 3 3

output:

possible

result:

ok single line: 'possible'

Test #59:

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

input:

4
1 1 4 2
1 3 2 4
3 3 4 4
1 5 4 6

output:

possible

result:

ok single line: 'possible'

Test #60:

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

input:

4
1 1 4 2
1 3 2 4
3 3 4 4
1 6 4 7

output:

impossible

result:

ok single line: 'impossible'

Test #61:

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

input:

4
1 1 5 2
1 3 2 4
4 3 5 4
1 5 5 6

output:

impossible

result:

ok single line: 'impossible'

Test #62:

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

input:

11
1 1 2 5
1 5 3 6
2 4 7 5
8 8 9 12
4 5 5 7
4 7 6 8
5 5 6 7
6 5 7 8
3 5 4 8
3 8 8 9
7 2 8 8

output:

possible

result:

ok single line: 'possible'

Test #63:

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

input:

11
8 1 9 5
7 5 9 6
3 4 8 5
1 8 2 12
5 5 6 7
4 7 6 8
4 5 5 7
3 5 4 8
6 5 7 8
2 8 7 9
2 2 3 8

output:

possible

result:

ok single line: 'possible'

Test #64:

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

input:

3
1 1 2 2
2 3 3 4
1 5 2 6

output:

possible

result:

ok single line: 'possible'

Test #65:

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

input:

3
999999998 3 999999999 4
999999997 1 999999998 2
999999996 999999998 999999997 999999999

output:

impossible

result:

ok single line: 'impossible'

Test #66:

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

input:

3
999999998 2 999999999 3
999999997 1 999999998 2
999999996 999999998 999999997 999999999

output:

possible

result:

ok single line: 'possible'

Test #67:

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

input:

3
999999998 1 999999999 2
999999997 3 999999998 4
999999996 999999998 999999997 999999999

output:

possible

result:

ok single line: 'possible'

Test #68:

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

input:

1
0 0 1 1

output:

possible

result:

ok single line: 'possible'

Test #69:

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

input:

1
999999999 999999999 1000000000 1000000000

output:

possible

result:

ok single line: 'possible'

Test #70:

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

input:

1
0 0 1000000000 1000000000

output:

possible

result:

ok single line: 'possible'

Test #71:

score: 0
Accepted
time: 127ms
memory: 27420kb

input:

200000
1 149207 177011 149208
1 250625 297332 250626
1 150344 178360 150345
1 391761 464773 391762
7135 1 7136 6021
1 498613 591541 498614
1 390943 463803 390944
1 581842 690282 581843
1 835150 990803 835151
1 754416 895021 754417
1 356555 423005 356556
177276 1 177277 149432
1 451339 535455 451340
...

output:

possible

result:

ok single line: 'possible'

Test #72:

score: 0
Accepted
time: 168ms
memory: 27356kb

input:

200000
1 696969 826867 696970
938207 1 938208 790819
892676 1 892677 752441
1 190373 225850 190374
1 715182 848475 715183
1 537506 637683 537507
1 307378 364663 307379
539381 1 539382 454650
975802 1 975803 822508
1 800042 949151 800043
394619 1 394620 332630
108948 1 108949 91839
1 2720 3221 2721
1...

output:

impossible

result:

ok single line: 'impossible'

Test #73:

score: 0
Accepted
time: 88ms
memory: 24644kb

input:

200000
385175 365578 385176 365579
300614 470004 300615 470005
419784 322839 419785 322840
79247 743356 79263 743357
63977 762185 64016 762186
248897 533869 248899 533870
530082 186616 530083 186631
376213 376643 376214 376646
640957 49688 640958 49709
55344 772892 55345 772894
573983 132403 573984 ...

output:

possible

result:

ok single line: 'possible'

Test #74:

score: 0
Accepted
time: 166ms
memory: 29240kb

input:

200000
277928 441016 277929 441017
38203 737046 38215 737047
107600 651352 107601 651360
553840 100242 553841 100284
550982 103811 550983 103814
130949 622516 130950 622526
70356 697351 70359 697352
375705 320265 375706 320269
224082 507507 224087 507508
251321 473872 251322 473875
182993 558254 182...

output:

impossible

result:

ok single line: 'impossible'

Test #75:

score: 0
Accepted
time: 139ms
memory: 27396kb

input:

200000
780657 658019 780695 658020
533390 449573 533391 449600
614515 517820 614516 517980
513457 432797 513458 432801
977953 824503 978171 824504
33855 28542 33856 28543
350258 295224 350259 295238
685219 577575 685220 577576
976126 822780 976136 822781
228399 192523 228403 192524
628364 529655 628...

output:

possible

result:

ok single line: 'possible'

Test #76:

score: 0
Accepted
time: 183ms
memory: 28184kb

input:

200000
656935 553735 656937 553736
440992 371799 441090 371800
391162 330627 392245 330628
676333 548180 676334 570086
549046 462795 549058 462796
822092 692945 822093 692946
866467 730665 866843 730666
175645 147917 175646 148057
365798 308336 365824 308337
741843 625303 741844 625304
325518 274384...

output:

impossible

result:

ok single line: 'impossible'

Test #77:

score: 0
Accepted
time: 83ms
memory: 23852kb

input:

200000
370349 420874 371004 420875
110733 741488 154653 741489
424310 354235 424311 354251
605217 130816 605224 130817
125875 722788 125876 722789
464667 304396 464670 304397
495679 266097 496802 266098
427495 350301 427496 350457
523121 232208 523122 232209
52289 813663 52290 813664
268784 546302 2...

output:

possible

result:

ok single line: 'possible'

Test #78:

score: 0
Accepted
time: 179ms
memory: 27308kb

input:

200000
157232 646689 157235 646690
619387 74857 619388 74860
49339 780189 49341 780190
339101 421662 339103 421663
495550 228085 495551 228088
440715 295927 440721 295928
525976 190432 525982 190433
81000 741008 81007 741009
161986 640804 161992 640805
251773 529715 251774 529717
655313 30407 655730...

output:

impossible

result:

ok single line: 'impossible'

Test #79:

score: 0
Accepted
time: 9ms
memory: 5372kb

input:

20973
5496 3932 5500 3934
2038 9716 2092 9717
4676 5305 4677 5313
5154 4480 5162 4492
1307 10937 1308 10943
5385 4118 5386 4122
5197 2794 6176 2795
7355 808 7361 811
303 12624 304 12625
2050 9699 2051 9700
1039 11392 1041 11393
4022 6399 4023 6400
6192 2755 6195 2763
6441 2332 6452 2333
5429 4044 54...

output:

possible

result:

ok single line: 'possible'

Test #80:

score: 0
Accepted
time: 44ms
memory: 18456kb

input:

113132
799436029 399979233 799436030 400033707
800007573 137372284 800007574 662640656
530922654 400001383 530922655 400011557
35835236 399986648 35835237 400026292
251345273 400000605 251345274 400012335
799992654 367990186 799992655 432022754
614077254 399997468 614077255 400015472
800012009 25871...

output:

possible

result:

ok single line: 'possible'

Test #81:

score: 0
Accepted
time: 95ms
memory: 20024kb

input:

113132
21298 375572599 21299 424440344
2701 72720454 2702 727292489
259823 399978869 259824 400034074
388577909 400006065 388577910 400006878
423274581 400005637 423274582 400007306
6966 172738969 6967 627273974
800005326 186343405 800005327 613669538
630897802 399996578 630897803 400016365
79999631...

output:

impossible

result:

ok single line: 'impossible'

Test #82:

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

input:

200000
39445174 30184921 39445178 30184925
327727743 250636295 327727744 250636296
383245654 293091461 383246038 293091845
168192484 128638744 168192485 128638745
448020249 342624685 448020254 342624690
278245622 212797026 278245623 212797027
356799188 272867400 356799189 272867401
3779534 2911194 3...

output:

possible

result:

ok single line: 'possible'

Test #83:

score: 0
Accepted
time: 128ms
memory: 27424kb

input:

200000
230946652 230946778 230946653 230946779
226617518 226617641 226617520 226617643
141829697 141829823 141829698 141829824
266158769 266158895 266158770 266158896
162747929 162748057 162747932 162748060
315923640 315923766 315923641 315923767
316149576 316149703 316149578 316149705
239706272 239...

output:

possible

result:

ok single line: 'possible'

Test #84:

score: 0
Accepted
time: 173ms
memory: 27388kb

input:

200000
649298423 796866093 649304077 796873032
493027627 605079207 493028177 605079882
280841367 344668797 280844227 344672307
150711037 184963392 150711983 184964553
285520239 350411049 285520283 350411103
371719363 456200883 371723829 456206364
390014739 478654299 390016125 478656000
137962719 169...

output:

impossible

result:

ok single line: 'impossible'

Test #85:

score: 0
Accepted
time: 169ms
memory: 28412kb

input:

200000
343937798 343933665 343939819 343935686
651753087 651748954 651754003 651749870
41623228 41619095 41625973 41621840
310406967 310402834 310411800 310407667
50057463 50053330 50059051 50054918
246327813 246323680 246340549 246336416
338011725 338007592 338013928 338009795
427775775 427771642 4...

output:

impossible

result:

ok single line: 'impossible'

Test #86:

score: 0
Accepted
time: 172ms
memory: 27392kb

input:

200000
207097280 310645122 207097596 310645596
68355522 102532485 68357164 102534948
409792210 614687517 409792786 614688381
172557334 258835203 172558586 258837081
206018844 309027468 206021290 309031137
241874460 362810892 241875268 362812104
515366706 773049261 515371026 773055741
417799306 62669...

output:

impossible

result:

ok single line: 'impossible'

Test #87:

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

input:

5
84824278 418910089 234643448 868564319
417241321 393558766 422879110 922520137
426597549 396398302 442303689 922611039
488699915 420176764 523651705 921232998
700852378 566058023 931170340 890546929

output:

possible

result:

ok single line: 'possible'

Test #88:

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

input:

20
46164108 236987837 92514477 836030726
107223931 294849707 112567898 830024504
132556373 317194776 139906186 827701561
180814338 357067167 224092854 823550478
281260349 428725445 320564875 816063077
324334556 454763837 351128769 813329391
354271604 471202312 357522802 811598146
445502225 512909475...

output:

possible

result:

ok single line: 'possible'

Test #89:

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

input:

1000
434936 364464056 1267375 974507461
1991644 364124131 2042086 973126634
2742137 363960478 2940388 972461994
3250914 363849618 3524895 972011811
3647781 363763189 4089151 971660870
4293689 363622611 4685324 971090119
5132017 363440318 5151907 970350100
6242700 363199083 6472024 969370989
7196825 ...

output:

possible

result:

ok single line: 'possible'

Test #90:

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

input:

200000
4239 818865124 6577 853151974
9874 818866288 13419 853155879
14626 818867268 14668 853159172
17418 818867845 17975 853161107
20373 818868455 21156 853163154
23413 818869082 24087 853165261
24704 818869349 24950 853166155
25791 818869573 28219 853166908
28264 818870083 30110 853168622
30540 81...

output:

impossible

result:

ok single line: 'impossible'

Test #91:

score: 0
Accepted
time: 70ms
memory: 23864kb

input:

200000
2842 491094723 3706 830387847
4999 491096322 5490 830384935
7001 491097807 9006 830382232
9016 491099302 16679 830379511
23507 491110050 28636 830359948
29740 491114673 35022 830351533
39355 491121805 44105 830338553
44366 491125522 47910 830331789
48595 491128658 54255 830326080
62247 491138...

output:

possible

result:

ok single line: 'possible'

Test #92:

score: 0
Accepted
time: 65ms
memory: 24592kb

input:

200000
1574 21391523 2243 566238961
3547 21394630 5058 566238125
5176 21397195 6911 566237434
8975 21403178 9953 566235823
11455 21407083 16142 566234772
18396 21418013 18450 566231829
21955 21423617 26664 566230320
28177 21433415 31781 566227682
33956 21442515 34582 566225232
37008 21447321 39810 5...

output:

possible

result:

ok single line: 'possible'

Test #93:

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

input:

5
33318469 79020281 37005049 346704446
357538079 66580243 448699194 334264408
768874022 229259343 771523913 496943508
819324440 262953608 850832674 530637773
894290146 318566477 941454889 586250642

output:

possible

result:

ok single line: 'possible'

Test #94:

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

input:

20
27338524 414089751 30944154 727519324
78668278 354838943 81487537 668268516
136686048 295039017 146131309 608468590
148388281 283899541 154449354 597329114
221229792 221521907 227859391 534951480
230073098 214765481 261600234 528195054
323597074 154133290 324094966 467562863
351879404 139691649 3...

output:

possible

result:

ok single line: 'possible'

Test #95:

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

input:

1000
752701 158758957 1083950 418645552
1271287 158923616 1383446 418810211
1635215 159039068 2027996 418925663
2746918 159391228 4047083 419277823
4545829 159959435 6563065 419846030
6582093 160600161 6765834 420486756
6815322 160673383 7320960 420559978
7352262 160841822 8136049 420728417
9070300 ...

output:

possible

result:

ok single line: 'possible'

Test #96:

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

input:

5000
78447 171119645 203651 360997014
269410 171383542 273981 361260911
332768 171471086 533274 361348455
642304 171898693 647313 361776062
672529 171940439 793757 361817808
886172 172235479 892071 362112848
898858 172252996 962299 362130365
1057495 172472024 1105335 362349393
1114214 172550326 1161...

output:

impossible

result:

ok single line: 'impossible'

Test #97:

score: 0
Accepted
time: 6ms
memory: 4564kb

input:

10000
14484 326880126 130390 348928295
205761 327129050 239388 349177219
407607 327391676 468543 349439845
542814 327567565 642091 349615734
659400 327719211 671320 349767380
673224 327737191 724410 349785360
828608 327939271 883702 349987440
958348 328107976 1011088 350156145
1107527 328301930 1136...

output:

impossible

result:

ok single line: 'impossible'

Test #98:

score: 0
Accepted
time: 108ms
memory: 27636kb

input:

200000
2717 267704322 10275 337312967
10806 267700941 14064 337309586
19850 267697162 29725 337305807
29772 267693016 37570 337301661
41305 267688196 47433 337296841
47519 267685600 47934 337294245
48342 267685256 51636 337293901
52394 267683563 53053 337292208
54136 267682835 54139 337291480
54903 ...

output:

impossible

result:

ok single line: 'impossible'

Test #99:

score: 0
Accepted
time: 54ms
memory: 23244kb

input:

200000
4481 471749178 13163 961802779
20704 471749137 22178 961802738
22926 471749132 26656 961802733
27526 471749120 28097 961802721
30530 471749113 31039 961802714
39816 471749089 46258 961802690
47308 471749070 47608 961802671
51720 471749059 51748 961802660
60016 471749038 67059 961802639
74113 ...

output:

possible

result:

ok single line: 'possible'

Test #100:

score: 0
Accepted
time: 61ms
memory: 25056kb

input:

200000
3007 474716193 9696 547269918
9714 474717235 11100 547270960
12390 474717650 15932 547271375
19119 474718696 19265 547272421
21151 474719011 21406 547272736
25297 474719655 27293 547273380
30011 474720388 30423 547274113
33010 474720854 36420 547274579
37056 474721482 39316 547275207
42737 47...

output:

possible

result:

ok single line: 'possible'

Test #101:

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

input:

5
94121767 384769963 225761381 556264172
271500421 382571891 297356757 556039739
365124878 379476196 428052740 555826502
484599800 373583576 499821414 555459287
573946455 367753652 660031184 555114980

output:

possible

result:

ok single line: 'possible'

Test #102:

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

input:

20
42146630 375431302 83220591 874707713
128959993 447678773 132415551 869732496
154999193 467508393 157790558 868387799
165956013 475598434 168419478 867842333
191075905 493578238 197615442 866637302
212651121 508389874 220774914 865652913
313135275 569691068 324992855 861684245
329573597 578515531...

output:

possible

result:

ok single line: 'possible'

Test #103:

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

input:

1000
571596 101102498 1011200 797851954
1134732 101596848 1307714 797836719
1846192 102220888 2510815 797817562
4846219 104845941 4876383 797737891
5095790 105063855 5177393 797731344
5899363 105765018 6012390 797710348
6197674 106025124 6384440 797702586
6891213 106629449 7205306 797684610
7482374 ...

output:

possible

result:

ok single line: 'possible'

Test #104:

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

input:

5000
11810 160060001 198532 474529373
258160 159968328 361825 474485590
396229 159916963 784302 474461069
949205 159711349 1112469 474362979
1127507 159645085 1246045 474331392
1398813 159544292 1458615 474283369
1480530 159513941 1681626 474268913
1862318 159372186 1870729 474201432
1956591 1593371...

output:

possible

result:

ok single line: 'possible'

Test #105:

score: 0
Accepted
time: 4ms
memory: 4488kb

input:

10000
34232 4081202 87810 817060151
138502 4246856 147911 817079712
155510 4273876 222831 817082902
334671 4558464 342139 817116507
401441 4664512 505246 817129029
535214 4876956 547785 817154115
650739 5060397 686716 817175775
712295 5158132 853414 817187316
867803 5405012 874039 817216467
981381 5...

output:

possible

result:

ok single line: 'possible'

Test #106:

score: 0
Accepted
time: 81ms
memory: 24512kb

input:

200000
272 64691870 557 834787814
2344 64691566 8350 834787279
10633 64690346 11807 834785139
12057 64690136 15311 834784772
16067 64689546 16366 834783736
20853 64688841 24216 834782501
25191 64688203 28974 834781381
29884 64687512 31581 834780169
33059 64687045 37944 834779350
38545 64686238 39781...

output:

possible

result:

ok single line: 'possible'

Test #107:

score: 0
Accepted
time: 71ms
memory: 23472kb

input:

200000
3532 32938781 6087 962609722
6879 32938719 9127 962606061
16261 32938546 21758 962595801
22920 32938423 23556 962588519
30115 32938290 32211 962580650
33518 32938227 36977 962576929
38590 32938133 45272 962571382
45947 32937997 52149 962563337
52239 32937880 62097 962556456
62190 32937696 634...

output:

possible

result:

ok single line: 'possible'

Test #108:

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

input:

5
37821 184782484 37822 184999404
182453 73956210 182454 74266310
64327 164484492 64328 164646072
176440 62125712 176441 78572622
167814 70949210 167815 85439544

output:

possible

result:

ok single line: 'possible'

Test #109:

score: -100
Wrong Answer
time: 0ms
memory: 3500kb

input:

20
93783 539287640 93784 539786726
56604 445338086 56605 473485515
72311 493802405 72312 507456906
123383 560079802 123384 591675895
15949 258551131 15950 519469248
168086 503470094 168087 808812989
135391 555384133 135392 660394333
196464 412011584 196465 975907220
50084 421340691 50085 495439389
1...

output:

impossible

result:

wrong answer 1st lines differ - expected: 'possible', found: 'impossible'