CT34959

Xanthe's panels Reckoning

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the monsoon port of Rainhaven pays by the answer, and Xanthe intends to earn it. First: the full register of panels. 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 <= 1146; 0 <= a[i] <= 1000000.

Example 1:

Input: 250 301888 538144 693690 721949 360071 273739 295678 596619 295193 947634 332575 12724 649354 516760 331285 870114 881354 675148 409438 837733 234292 327310 261533 726607 587192 962215 431202 176279 153171 219178 943786 577209 750830 561377 925511 526900 617452 837973 301142 102062 376751 938135 636129 819173 776379 26663 858026 988686 838943 80693 756693 823989 743503 514275 148148 89342 450116 318853 722011 949981 272087 203387 771794 963506 328183 263466 985287 686297 540618 132134 299177 210019 57282 432935 253552 133923 552302 237036 103682 88734 796583 163062 879832 809750 440328 687866 557487 420957 451060 124548 499337 787087 576732 70836 95807 346959 369245 909442 5114 168222 936509 844325 264066 291610 614627 35843 397057 373073 680443 389552 678845 192870 772999 928221 17833 291…
Output: 7

Example 2:

Input: 959 830755 948461 41158 805549 654889 454032 877688 792722 95348 424964 346490 513158 665732 283978 951293 716505 870100 227689 347748 420960 61626 489879 617927 6569 714121 140396 657746 752194 344422 719986 611056 773505 583920 577796 450566 20374 679045 771229 778193 941600 233543 160912 332319 918358 729256 998527 676209 37730 332536 800603 626003 763783 360801 961774 907920 544005 135827 39411 767533 323779 360449 398080 378743 341770 373086 243046 312642 169434 835215 475546 827636 999740 640422 357490 213494 149336 178230 285076 979487 323959 417778 429585 131513 964027 507285 571719 37666 900528 902562 936190 27647 584080 44310 312442 570999 22177 15748 457324 573662 124537 903918 224901 746927 229737 609017 228589 799446 890065 401628 783405 862161 965157 322031 902474 394144 9100…
Output: 13

Example 3:

Input: 248 893139 797306 121090 268828 456553 384852 949798 906363 12808 918251 907547 220839 502419 990404 223006 982884 29174 547581 428280 226796 939956 438411 330883 111553 931761 849085 888424 837618 506797 440083 2280 278153 734355 600809 760064 869265 617653 609060 321960 14525 11661 243649 944522 807177 736902 138171 715423 623730 434333 631079 67062 50446 896134 96668 744495 563863 286911 637979 110685 70159 192324 977149 456295 486052 362949 706251 760708 26072 145436 387851 108608 35959 736735 406293 35096 695562 63347 505451 672767 812309 372882 766451 924002 786069 505438 49415 197143 622823 317996 908390 198707 584072 527949 871981 487798 843143 130148 158660 310252 381773 716057 950712 552740 47194 83342 797768 879828 929158 780623 282619 87597 500084 332639 125298 521924 87983 273…
Output: 7

Constraints:

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

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