QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#46846#4671. Independent RectanglesQingyuAC ✓357ms71928kbC++232.1kb2022-09-02 00:05:252022-09-02 00:05:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-02 00:05:26]
  • 评测
  • 测评结果:AC
  • 用时:357ms
  • 内存:71928kb
  • [2022-09-02 00:05:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e6 + 10;
int n;
struct Node {
	int cnt, sum;
	Node(int c = 0, int s = 0) : cnt(c), sum(s) {}
	friend Node operator + (Node a, Node b) {return Node(a.cnt + b.cnt, a.sum ^ b.sum);}
	friend Node operator - (Node a, Node b) {return Node(a.cnt - b.cnt, a.sum ^ b.sum);}
	Node& operator += (Node x) {return *this = *this + x;}
	Node& operator -= (Node x) {return *this = *this - x;}
};
struct Bit {
	Node c[N];
	void upd(int p, Node x) {
		for(p; p < N; p += p & -p) c[p] += x;
	}
	Node qry(int p) {
		Node ans;
		for(; p; p -= p & -p) ans += c[p];
		return ans;
	}
}d1, d2, d3, d4;
struct Oper {
	int l, r, w;
	Oper(int _l, int _r, int _w) : l(_l), r(_r), w(_w) {}
};
vector<Oper> upd[N];
Node deg[N];
int main() {
	// freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		int x1, x2, y1, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		upd[x1].emplace_back(y1, y2, i);
		upd[x2].emplace_back(y1, y2, -i);
	}
	Node all(0, 0);
	auto get = [&] (int w){return Node(w > 0 ? 1 : -1, abs(w));};
	for(int i = 0; i < N; i ++) {
		for(auto [l, r, w] : upd[i]) {
			d1.upd(r, get(w));
			d2.upd(N - l - 1, get(w));
			all += get(w);
		}
		for(auto [l, r, w] : upd[i]) {
			if(w < 0) continue;
			Node cur = all - d1.qry(l) - d2.qry(N - r - 1) - get(w);
			deg[w] += cur;
		}
	}
	all = Node(0, 0);
	for(int i = N - 1; i >= 0; i --) {
		for(auto [l, r, w] : upd[i]) {
			if(w < 0) continue;
			Node cur = all - d3.qry(l) - d4.qry(N - r - 1);
			deg[w] += cur;
		}
		for(auto [l, r, w] : upd[i]) {
			if(w < 0) continue;
			d3.upd(r, get(w));
			d4.upd(N - l - 1, get(w));
			all += get(w);
		}
		for(auto [l, r, w] : upd[i]) {
			if(w > 0) continue;
			Node cur = all - d3.qry(l) - d4.qry(N - r - 1);
			deg[-w] -= cur;
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; i ++) if(deg[i].cnt == 1) {
		int v = deg[i].sum;
		if(deg[v].cnt == 1) {
			assert(deg[v].sum == i);
			ans ++;
		}
	}
	cout << ans / 2 << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 26ms
memory: 66136kb

input:

3
0 0 3 3
2 2 4 4
5 8 8 12

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 24ms
memory: 66212kb

input:

100
923310 372242 983605 907038
478627 492039 803226 736310
739241 381263 902708 567562
880442 960239 931687 994497
488788 247833 753798 332045
409430 647897 485436 789226
710160 614075 850921 635725
374903 876893 928920 992955
513455 801995 638877 931475
526983 755886 690371 898669
730825 514053 99...

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 28ms
memory: 66124kb

input:

100
668829 645577 739240 720922
827728 798471 840133 921016
166981 838674 177697 953637
607562 915466 744100 946011
461595 814141 601422 934072
531131 631369 575749 677973
966788 387713 969085 398515
48155 699081 115993 762903
121662 168194 237366 236805
870992 538874 982334 607408
640220 607061 766...

output:

4

result:

ok 1 number(s): "4"

Test #4:

score: 0
Accepted
time: 26ms
memory: 66076kb

input:

100
719957 362255 834516 368558
108916 415918 133345 462802
671323 624283 775255 703275
648155 131697 664667 182153
815556 173854 838389 235125
209215 830821 233579 937008
243348 897872 335620 998966
905727 999204 953624 999714
858675 330013 909371 358474
707086 696316 791327 785517
486841 968916 55...

output:

4

result:

ok 1 number(s): "4"

Test #5:

score: 0
Accepted
time: 20ms
memory: 66212kb

input:

100
742676 107342 818280 184604
418511 61774 474964 107590
147257 402258 244406 485280
688748 347927 696722 366371
197927 598019 291063 615223
822844 30274 858441 114829
548317 436440 550867 464657
698847 363780 773987 368465
660142 463422 665830 511733
571590 882168 612505 972036
269009 294729 3447...

output:

4

result:

ok 1 number(s): "4"

Test #6:

score: 0
Accepted
time: 11ms
memory: 66228kb

input:

100
790700 132127 849404 208638
790161 303721 851470 378234
633860 507607 659551 532567
391309 928270 419282 936712
900796 218940 932887 266765
71508 593777 73298 615818
933428 428396 992979 441176
432491 137233 444859 216151
563911 995937 594144 996042
956496 702687 977077 747384
161887 484626 2003...

output:

6

result:

ok 1 number(s): "6"

Test #7:

score: 0
Accepted
time: 26ms
memory: 66140kb

input:

100
334286 508487 350809 548925
926937 626648 984258 686978
386032 914615 431980 930038
865174 32569 875230 45773
91982 384591 137128 444638
396345 179299 406456 202620
71709 201498 106455 208599
879299 797681 898293 800462
918213 76847 946550 92396
388748 313635 435650 354409
549153 165554 550437 2...

output:

7

result:

ok 1 number(s): "7"

Test #8:

score: 0
Accepted
time: 28ms
memory: 66280kb

input:

100
813418 820395 840463 847865
99757 921167 133090 927315
109794 321625 128702 330615
431902 108457 444041 137207
254758 586287 257151 635453
692772 793229 718500 826342
238398 966963 255579 985055
290064 465765 338787 525114
336969 157756 354898 173230
792591 916948 823574 949608
944054 810438 977...

output:

10

result:

ok 1 number(s): "10"

Test #9:

score: 0
Accepted
time: 19ms
memory: 66200kb

input:

100
372088 941842 396508 968789
546128 825497 567497 844906
366307 478199 390176 488977
3179 465029 4671 466912
771495 168469 782654 185789
659649 642656 663443 666632
681647 250224 710053 263252
586809 462381 613105 468729
456695 372075 477719 383133
89347 685338 102302 693254
149533 788769 176103 ...

output:

3

result:

ok 1 number(s): "3"

Test #10:

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

input:

1000
151456 273358 334968 927634
323184 440849 924162 733496
723057 590146 936301 728857
231953 664040 875312 885430
487424 461742 887049 742537
466146 988885 995018 992618
651109 583326 857405 894029
6278 490862 800841 980072
476165 833311 942039 881196
819061 417268 896101 756652
195649 802095 920...

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

99998
618791 52328 673851 401271
493507 676922 971854 939501
234756 113412 369346 595909
422658 877573 477696 939780
629061 248612 696036 426680
23423 273398 848255 547910
742937 220078 822338 598716
133336 805250 186974 814565
961008 48029 971687 709978
232008 823704 712208 878032
482897 326390 996...

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 282ms
memory: 71808kb

input:

99999
946219 573194 965046 859598
88737 568555 961203 931994
911827 361241 961338 573937
15649 375299 860723 907495
488719 57427 802449 563138
829362 948560 855862 948787
157416 81798 351109 778505
396278 394486 677725 825550
264516 665317 662351 834805
151099 391453 822166 702665
907992 939123 9183...

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 279ms
memory: 71612kb

input:

100000
37321 793611 84250 865751
764019 516977 992503 721349
954520 458016 957456 683820
553550 132802 948277 668630
868081 479633 946674 809890
255979 61023 807097 986310
621636 730427 683235 965942
846495 432622 918353 671505
726888 639212 749207 797167
959962 957706 963392 997329
922940 532756 96...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 0
Accepted
time: 311ms
memory: 71776kb

input:

100000
155934 318778 181958 388958
276301 201565 322073 207131
931595 102287 963772 131409
762376 980161 836165 997970
683202 628519 691259 679396
859836 566433 865523 567935
525306 824517 612860 834053
392991 68810 459574 167205
677469 464153 695814 509139
537468 476702 586999 501691
696607 235964 ...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 265ms
memory: 71820kb

input:

100000
493465 116625 499059 120505
455488 957276 494851 964244
234240 199709 237885 210209
608794 811696 646313 838584
797230 741945 808320 778836
37900 416004 66687 437030
433629 834765 451410 846439
201273 558054 211814 563384
433618 472204 460822 492986
21474 478759 37659 480653
928629 828581 950...

output:

0

result:

ok 1 number(s): "0"

Test #16:

score: 0
Accepted
time: 259ms
memory: 71916kb

input:

100000
8642 456941 34759 467852
592264 280205 617639 282991
986411 606717 994356 634975
111069 923628 113775 938766
988414 907596 990185 934005
362737 29935 389845 38049
571909 571823 594829 586330
619671 254547 647238 266445
816329 524704 821637 548115
453726 53663 462504 64338
351940 509509 374890...

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 356ms
memory: 71796kb

input:

100000
516184 833301 525927 842731
736675 603132 748062 621736
738582 13727 742740 28256
649387 999517 654176 999730
151191 101658 161095 114481
659164 615456 671889 630657
738598 344924 739361 349561
30436 886586 31924 892347
235086 605614 237282 606246
885977 636201 894645 638762
746841 190438 762...

output:

1

result:

ok 1 number(s): "1"

Test #18:

score: 0
Accepted
time: 254ms
memory: 71864kb

input:

100000
254128 471730 264635 488117
907422 198861 914235 199613
671148 836879 678818 840087
875962 243738 878239 253970
304406 642196 306463 658806
268607 673920 278756 688317
41517 523898 54112 527852
139473 738312 152015 738585
298065 108564 304231 126174
61095 66473 67831 77422
60299 510865 71679 ...

output:

2

result:

ok 1 number(s): "2"

Test #19:

score: 0
Accepted
time: 265ms
memory: 71788kb

input:

100000
377782 292399 382367 304393
677079 175681 681633 176400
400508 150851 403879 163552
552226 952344 567509 960323
73624 720335 80875 733445
358986 86128 367227 96893
387881 894595 401007 895095
313796 182176 329844 184850
92537 823830 100498 825913
145816 734676 156006 739714
241222 783666 2577...

output:

1

result:

ok 1 number(s): "1"

Test #20:

score: 0
Accepted
time: 246ms
memory: 71880kb

input:

100000
671153 826491 677891 832715
908458 62461 915916 68952
552542 128808 558584 137908
531834 191799 534408 200126
309187 954752 323047 966580
622487 423244 634284 429035
463015 820962 476520 833419
836767 642673 839447 651526
475953 897543 476834 899235
221889 667198 226632 675991
619043 658888 6...

output:

5

result:

ok 1 number(s): "5"

Test #21:

score: 0
Accepted
time: 301ms
memory: 71888kb

input:

100000
833234 532282 836832 535721
390955 980055 401383 988863
3626 756750 6558 757348
855952 665828 862027 669650
811577 147075 820531 158608
831653 312111 835427 317855
155743 433450 159094 441510
157006 602489 163403 604336
28853 292033 32540 302157
270059 910742 272413 919714
908802 232901 91142...

output:

5

result:

ok 1 number(s): "5"

Test #22:

score: 0
Accepted
time: 251ms
memory: 71760kb

input:

100000
23726 209663 23992 213020
901859 897651 909258 902073
454710 384692 461828 386980
151662 139859 158534 140281
342376 331762 352231 339511
984001 229387 985047 238572
876878 81982 885884 86749
477244 554670 481166 559703
589388 722567 589688 723124
318230 211106 323683 215552
170152 835321 171...

output:

23

result:

ok 1 number(s): "23"

Test #23:

score: 0
Accepted
time: 251ms
memory: 71764kb

input:

100000
928488 179979 934146 181569
659594 938865 666599 947096
773269 352955 779305 358257
557172 901374 560156 906460
465589 293028 468946 294224
435546 471747 444421 475775
177074 168875 178059 177704
36429 757624 39954 765648
918163 800400 926464 806708
666760 153948 669065 161449
156167 620870 1...

output:

49

result:

ok 1 number(s): "49"

Test #24:

score: 0
Accepted
time: 271ms
memory: 71924kb

input:

100000
734595 275553 735391 279134
734483 410457 734722 415032
897122 364968 905557 368931
216800 675146 224277 682384
663190 935674 671444 936917
763469 818899 765983 820397
698209 601603 700615 607463
393349 962760 393895 966028
977986 423231 978237 427057
810954 118852 818604 120726
23939 346164 ...

output:

97

result:

ok 1 number(s): "97"

Test #25:

score: 0
Accepted
time: 275ms
memory: 71704kb

input:

100000
23734 36692 24173 44593
372434 879640 375372 885030
502629 666926 509958 670937
176618 666798 184096 667440
234807 371167 235359 377568
554334 948406 555493 955507
523437 503528 529145 506710
210753 237533 217488 242446
712636 451214 719243 455187
694662 822151 698420 822741
329455 893671 336...

output:

125

result:

ok 1 number(s): "125"

Test #26:

score: 0
Accepted
time: 221ms
memory: 71764kb

input:

100000
801431 96221 804009 102113
475731 351233 481711 355467
654891 650530 657619 657998
900698 412161 905670 418751
432407 985404 433868 990148
817803 259515 824601 264381
44574 972299 47511 976013
567673 471077 571929 474746
772459 102454 776005 108444
867266 722602 874370 723565
140409 647374 14...

output:

220

result:

ok 1 number(s): "220"

Test #27:

score: 0
Accepted
time: 253ms
memory: 71924kb

input:

100000
126614 885768 132427 886276
142091 856460 148067 859304
231988 980897 237506 982401
852881 375404 858365 380089
996388 449306 999098 453911
644713 389022 649157 394003
869800 781363 870631 782795
356667 681396 361613 685902
478699 166481 479909 168222
714930 454310 716038 458990
445926 230926...

output:

378

result:

ok 1 number(s): "378"

Test #28:

score: 0
Accepted
time: 255ms
memory: 71840kb

input:

100000
932720 952933 938079 953432
216980 328053 223189 331945
348207 964501 353328 964962
548553 177585 551531 178126
165581 91953 169237 96697
908182 707766 911968 712513
390937 250135 397190 252394
741996 914941 745463 915499
538522 817720 542579 821682
895168 390805 901417 396654
256880 920176 2...

output:

606

result:

ok 1 number(s): "606"

Test #29:

score: 0
Accepted
time: 265ms
memory: 71892kb

input:

100000
221859 714072 222454 715892
890973 797236 892882 802239
925303 294868 929522 296569
500736 140829 501011 140966
737196 555854 740649 561768
735091 837273 739523 840327
216164 123651 221527 126436
523356 189714 524512 190917
265536 845703 268757 847917
742833 94105 747690 98874
562396 503727 5...

output:

1052

result:

ok 1 number(s): "1052"

Test #30:

score: 0
Accepted
time: 300ms
memory: 71928kb

input:

100000
909256 489246 912104 490168
292784 909563 293793 913633
35364 790679 38165 794829
2644 332357 6858 337383
519041 597421 523436 601767
289424 705314 291821 710047
820099 435807 824521 439752
183678 131922 188004 134360
808772 114586 813845 114972
987734 526127 990816 527858
295497 208066 29874...

output:

1431

result:

ok 1 number(s): "1431"

Test #31:

score: 0
Accepted
time: 274ms
memory: 71896kb

input:

100000
87321 929984 90512 933241
272927 991073 273094 993065
598667 568800 601433 570467
789472 677313 794029 677976
638858 488653 640291 489157
371152 391755 375313 394413
728127 152708 731090 154200
268438 50905 272093 54769
55244 695757 56999 696258
879287 789406 880052 793739
487117 742251 48760...

output:

2039

result:

ok 1 number(s): "2039"

Test #32:

score: 0
Accepted
time: 289ms
memory: 71840kb

input:

100000
317105 534741 317290 536168
632222 738011 634872 738173
683072 608839 687480 612841
148591 877843 149872 880024
470370 605584 474018 609998
825470 313933 826890 317355
626981 429895 629363 431034
697680 669621 698343 672417
60008 560971 61727 562849
799144 754673 800455 756019
707276 804938 7...

output:

2827

result:

ok 1 number(s): "2827"

Test #33:

score: 0
Accepted
time: 357ms
memory: 71924kb

input:

100000
123212 630314 126239 631232
699475 274057 703359 275371
806925 628487 811232 630946
844262 651615 846037 652948
667970 276640 668028 277101
117349 625041 118511 627433
83664 898666 85776 902824
90645 931575 92137 932127
91422 212211 95092 213402
943339 691168 944700 694387
546639 494188 54892...

output:

4225

result:

ok 1 number(s): "4225"

Test #34:

score: 0
Accepted
time: 255ms
memory: 71928kb

input:

100000
265232 99462 267298 102115
708027 327158 709569 328493
370229 406608 370713 406988
667134 32616 668548 33493
823831 111053 825230 111264
170668 311482 171598 315003
991690 615567 995342 618284
110952 850557 114173 851832
337893 821791 340241 822593
863301 926038 865645 926467
709849 28375 713...

output:

5291

result:

ok 1 number(s): "5291"

Test #35:

score: 0
Accepted
time: 277ms
memory: 71888kb

input:

100000
412350 419862 414317 422896
401879 714831 402758 716151
412432 930445 413029 933644
860898 614859 862673 617787
239587 683723 241942 686045
879805 726139 883509 729146
973344 707729 974554 709413
843594 141894 845763 144091
826071 240194 826097 241544
791003 394468 793472 394903
852155 106149...

output:

6078

result:

ok 1 number(s): "6078"

Test #36:

score: 0
Accepted
time: 333ms
memory: 71824kb

input:

100000
107383 166627 107591 168067
782915 827159 785099 827746
458038 418621 460121 420561
326762 806387 328277 806516
21432 782108 23829 785162
498590 594181 501159 596467
512827 48295 513100 51839
503916 84103 504559 86431
397716 509075 398402 509102
35905 826489 39390 827991
556847 753668 559008 ...

output:

7477

result:

ok 1 number(s): "7477"

Test #37:

score: 0
Accepted
time: 252ms
memory: 71832kb

input:

100000
190048 450983 193153 451712
440724 214833 441837 215305
500241 970867 500737 971726
520526 360221 521795 362097
437188 326370 439440 328831
179319 73293 181469 75361
430027 233319 432158 236035
264968 375439 267170 376380
885893 927477 886870 930140
935197 294919 936011 295727
663109 795398 6...

output:

8162

result:

ok 1 number(s): "8162"

Test #38:

score: 0
Accepted
time: 282ms
memory: 71836kb

input:

100000
396521 956174 398169 959130
420866 267933 421045 268435
63545 720579 65218 720764
286580 769630 288400 772455
557004 217602 558998 219922
289456 723688 290774 726481
338055 893402 339327 894977
313684 330466 316812 332334
132365 537058 134307 538932
919613 558198 921010 559516
826320 329585 8...

output:

9427

result:

ok 1 number(s): "9427"

Test #39:

score: 0
Accepted
time: 325ms
memory: 71924kb

input:

100000
479186 240531 480934 241876
114718 655606 116339 657381
134156 244417 137046 247109
480343 351874 481125 354654
972760 790271 973310 793094
970183 202799 973171 204174
319708 78427 320937 80465
17919 650211 18299 651297
620543 955460 622876 955475
847315 26627 849429 29151
968626 378950 96909...

output:

9953

result:

ok 1 number(s): "9953"

Test #40:

score: 0
Accepted
time: 259ms
memory: 71796kb

input:

100000
143273 859321 143520 860622
173420 74098 174416 76499
694705 478309 696621 479040
409961 744645 412493 746737
78954 541686 81268 543589
216379 799058 216949 799978
896772 794253 897694 796967
326123 900320 326698 902336
433895 968710 434589 970731
71548 728251 71928 730535
652413 562423 65366...

output:

10433

result:

ok 1 number(s): "10433"

Test #41:

score: 0
Accepted
time: 335ms
memory: 71848kb

input:

100000
285293 300060 287179 301896
181972 191652 183826 192283
258009 284839 258502 286999
139972 125646 140247 126782
170361 404509 171308 405471
269698 485499 271836 487344
776391 511154 777053 512723
410883 855346 411592 855688
680366 606700 682137 608028
991509 991530 991765 991723
815624 96609 ...

output:

10543

result:

ok 1 number(s): "10543"

Test #42:

score: 0
Accepted
time: 258ms
memory: 71896kb

input:

100000
610475 125652 611109 127308
884375 660835 884929 661577
863515 586796 864298 587493
156607 88889 157883 89121
741977 868410 743938 869733
60563 643415 61347 643863
637662 356261 639423 356844
192242 130119 193936 130798
415015 634683 416951 636466
839174 694830 839446 696739
85097 680160 8517...

output:

9959

result:

ok 1 number(s): "9959"

Test #43:

score: 0
Accepted
time: 272ms
memory: 71908kb

input:

100000
150755 523608 152334 524682
571559 357081 572672 358597
902963 530361 904615 530479
457116 662129 458570 662991
108066 337308 108701 338968
934166 68390 934534 68739
288354 540211 290017 540691
148329 716537 149633 717837
470073 485163 471086 485274
127964 630014 129028 631088
740344 342768 7...

output:

9689

result:

ok 1 number(s): "9689"

Test #44:

score: 0
Accepted
time: 290ms
memory: 71828kb

input:

100000
705721 917911 706433 918279
597214 601611 597997 602511
592875 900767 593655 900957
804461 825904 805232 826180
475150 946549 475306 946885
150942 91666 151010 92291
984025 726958 984613 727303
338157 573983 339062 574359
209487 349951 210433 350398
867076 326990 867098 327884
229977 952961 2...

output:

4168

result:

ok 1 number(s): "4168"

Test #45:

score: 0
Accepted
time: 248ms
memory: 71892kb

input:

100000
879175 168609 879355 168937
92980 594379 93175 594584
325808 858395 326308 858548
662005 966380 662148 966624
928932 422938 929106 423407
39540 115880 39555 116319
840148 115424 840337 115437
7605 604362 7676 604749
544689 763366 545087 763497
76852 130782 76865 131271
342473 18794 342593 189...

output:

1175

result:

ok 1 number(s): "1175"

Test #46:

score: 0
Accepted
time: 190ms
memory: 71308kb

input:

100000
2 0 5 2
5 1 7 2
6 0 9 2
9 1 11 2
10 0 13 2
13 1 15 2
14 0 17 2
17 1 19 2
18 0 21 2
21 1 23 2
22 0 25 2
25 1 27 2
26 0 29 2
29 1 31 2
30 0 33 2
33 1 35 2
34 0 37 2
37 1 39 2
38 0 41 2
41 1 43 2
42 0 45 2
45 1 47 2
46 0 49 2
49 1 51 2
50 0 53 2
53 1 55 2
54 0 57 2
57 1 59 2
58 0 61 2
61 1 63 2
...

output:

24999

result:

ok 1 number(s): "24999"

Test #47:

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

input:

100000
2 0 5 2
5 1 7 2
6 0 9 2
9 1 11 2
10 0 13 2
13 1 15 2
14 0 17 2
17 1 19 2
18 0 21 2
21 1 23 2
22 0 25 2
25 1 27 2
26 0 29 2
29 1 31 2
30 0 33 2
33 1 35 2
34 0 37 2
37 1 39 2
38 0 41 2
41 1 43 2
42 0 45 2
45 1 47 2
46 0 49 2
49 1 51 2
50 0 53 2
53 1 55 2
54 0 57 2
57 1 59 2
58 0 61 2
61 1 63 2
...

output:

49999

result:

ok 1 number(s): "49999"