CT33725

The Checker Stretch of Vineward

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the ivy courts of Vineward, Botanist studies rows of panels entries. One clean number will settle the guild's oldest argument. 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 <= 1605; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1414 832827802 161752925 264511059 167691619 70055789 604160039 261095689 643170877 657064428 214045414 449780880 495252014 116976557 479471168 482785476 542704918 899467314 992706721 349006548 347098909 761691286 412531818 894429628 472785629 862031433 390067714 525193699 99180229 8875346 638752900 844764544 595821798 328741515 826922018 90390445 782868372 589202211 875490835 103199071 767587819 511452399 988186971 220229734 839409033 681825480 389020528 958473293 611324389 474600418 855753877 825020525 192224971 610224685 755300932 877266280 858320726 40230820 897835643 196572873 731732363 984462447 353281689 999207054 541716518 922808437 528444856 460872488 981547375 108332299 48863940 529009447 151837608 552225816 289163726 557799564 763356966 587169259 4719299 121548570 538912908 1866…
Output: 9

Example 2:

Input: 1575 393611761 702629216 418948990 305565259 603795443 481687201 853371389 846504701 131210912 735244206 691762944 373601177 807257455 599481900 408858500 517524960 804150798 795826130 369423906 589545009 346470976 624342655 218524365 260843404 409051067 189207386 137340562 627601696 929818511 492493609 837647330 770087699 99748237 330069806 657234081 890731199 261211367 616598992 783287419 779722888 294941348 263864912 535599856 386159039 333061149 987096588 822599978 367495063 707679556 167434245 946639093 393767179 380159091 281390412 997419929 178396774 679880834 381906753 472918882 339814447 894163839 127946429 365663827 3189867 604208628 51330192 816848847 654960919 42131400 631721497 456628743 275140430 928261842 31106338 883899195 723124940 384486731 374911713 754037103 332403315 2…
Output: 12

Example 3:

Input: 50 950019440 80151961 776370202 107224342 176332005 764603449 530518705 274608232 354691749 73962126 368325261 239301285 323552520 813039484 694700353 538382523 28797988 860586670 562421723 823081167 797889452 443453375 602225051 838873775 312497859 591312889 466646534 745702743 635337641 157783567 473769962 196156262 619177571 791996916 353337206 939181273 89032586 886300682 757070157 802166151 878022303 521163665 307964870 154268571 757185728 211310767 723912158 298234583 813179326 682409394
Output: 8

Constraints:

1 <= n <= 1605; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Checker Stretch of Vineward - MEDIUM Coding Problem | CodeTikki