CT30846

Ulmar's windows Checker Stretch

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the quays of Driftwood. Ulmar spreads the windows records across the table and picks up a sharp pencil. 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 <= 3425; 0 <= a[i] <= 1000000.

Example 1:

Input: 953 875346 184748 870375 401778 866648 774527 629177 337543 198218 15517 927215 245451 70709 433614 605570 339041 986460 86744 593434 17254 837028 200948 300159 778048 864142 394302 717689 798212 453 241830 147280 852076 884025 535400 434887 992198 941627 611005 962488 153177 845774 214869 673391 151544 776043 615252 955436 10640 258258 47591 419348 707545 855058 855101 596394 409576 440781 274977 392832 425319 746320 163882 263500 171504 314730 866315 608819 662918 856265 818110 578421 183399 224292 228798 796348 774510 234446 43645 312284 772700 991693 269149 20969 420752 750382 694827 32302 174831 245061 707541 937463 656884 229568 209968 522396 441275 52640 418569 779339 504074 598571 709793 459164 988667 736773 736888 495750 411522 439682 20283 752745 716631 741574 38023 754228 515748…
Output: 9

Example 2:

Input: 192 723102 281375 10329 622929 142405 958455 309718 662801 434290 79792 632264 250470 294298 500791 451408 251337 858821 849384 61343 431875 977842 862371 254791 242603 370884 913208 305664 172614 156175 125716 352278 351937 437401 717019 404262 581705 771364 276117 614161 397177 280172 661803 337128 324237 158112 962343 707489 297486 854558 733121 4793 547680 614270 1566 66134 817617 949149 559907 570203 207166 398854 160790 208129 911935 68243 397691 214833 603247 700274 337899 830760 145964 5799 19766 283193 578873 933495 603430 612762 18928 457585 656284 36586 761353 567742 411747 506716 639793 665780 787892 459425 221387 582400 637182 593154 363588 520363 354892 697797 701588 56541 326478 23305 533958 39040 179643 51119 153160 620994 665647 657049 382145 708975 741606 900138 120271 44…
Output: 9

Example 3:

Input: 796 871132 211393 551223 969505 631034 953043 767379 153370 925072 56261 591425 61848 217310 599436 60731 421737 611748 642344 297730 229766 467827 531537 693072 755972 593145 657495 26724 191654 732584 309733 547612 46626 686389 296001 679972 435898 173918 914913 406519 666854 429316 247105 912740 785177 599625 478581 243410 739989 35594 420159 467892 513857 810022 766591 290357 230401 536852 482726 338650 85031 683562 455797 12114 898149 828182 675148 47851 84214 524000 160998 637730 964887 677684 693720 829452 270981 780589 213592 899193 45143 759874 703914 538599 870442 624230 765998 717767 233369 935991 593322 577602 662551 580917 648947 733510 686596 749328 613777 748626 376151 132645 309293 390093 912480 556471 348164 860719 729867 494410 991842 708728 233171 40080 830106 85839 5886…
Output: 10

Constraints:

1 <= n <= 3425; 0 <= a[i] <= 1000000.

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