CT30729

The Bright Checker Stretch

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the kelp forests of Tangledeep pays by the answer, and Chandler intends to earn it. First: the full register of windows. Task: Print the length of the longest contiguous run in which elements alternate even, odd, even, odd, ... Input format: First line: n. Second line: n integers. Output format: Print the maximum parity-alternating run length. Constraints: 1 <= n <= 2298; 1 <= a[i] <= 1000000.

Example 1:

Input: 1114 504543 10356 37808 213511 405774 451189 144440 854988 680294 580139 56973 650812 494246 95997 627487 828406 655899 401987 706323 147126 176700 707280 277280 217786 763134 739153 933102 119997 778892 646206 127990 112687 143557 523164 437841 893139 636947 122102 857518 160066 652294 346897 908746 477030 583721 452617 615797 55071 600289 426103 345184 780958 35054 166839 984439 242315 708578 618626 759882 624948 480488 477734 312321 671765 231139 793011 616410 770827 459581 122668 324127 268963 934557 78107 30603 755072 479919 672092 808243 328739 54915 865285 640580 74116 934110 308349 517023 646678 248761 654054 50688 404681 540342 620926 633335 996088 363274 384844 349062 755758 676781 440585 564525 661870 304786 902417 703003 564378 978011 105224 800416 3121 636686 180434 226767 165…
Output: 10

Example 2:

Input: 1204 799307 461858 91415 652839 988282 301807 14764 630041 649556 469071 805757 136317 673276 929085 679362 103305 567242 845397 407153 233480 183056 149586 223085 7735 180322 114815 323672 990122 484066 993062 999664 779992 98476 792042 49849 332049 17962 629678 19085 345967 404995 176352 653296 697788 381770 976003 389272 104861 783626 588709 777935 930157 630926 919671 637776 831437 689270 461223 954629 36618 509736 242560 12820 315389 872686 940225 525334 635676 715267 52071 279251 422353 181801 605369 937120 685878 481782 276076 159198 735072 155887 778027 509213 162769 9223 283764 600089 752781 905084 588430 293549 356142 222910 342866 662670 461054 803062 373836 246242 382966 685943 316325 830971 404787 79364 631962 398443 722957 356740 109721 528369 741216 467416 437004 815006 6905…
Output: 10

Example 3:

Input: 208 589415 951588 545782 487803 198830 73928 969657 579590 433994 474185 655004 730701 860118 52570 653442 877207 265699 371257 101231 908397 690131 226147 612524 581056 380985 670128 218587 396560 948888 549800 936578 243688 211623 414038 563268 562499 210746 725530 774785 646353 46136 345933 90292 180363 386593 882381 838816 173468 672098 504535 627462 833719 910609 202465 472001 95670 440555 261273 162976 652302 182216 511103 766793 495306 431951 940985 95197 791298 821497 194281 687394 591630 186745 350405 270288 714718 470850 334252 680386 115698 237725 425607 982267 800801 417019 114093 760535 623378 721498 718583 843226 209664 524684 322 73479 40164 136678 115461 907326 718883 362463 201256 409817 834981 450979 242957 434818 498783 42345 747106 3873 565962 933526 403000 380276 97524…
Output: 5

Constraints:

1 <= n <= 2298; 1 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.