CT23847

The Checker Stretch Beneath Beeswick

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the honeycomb cliffs of Beeswick; Librarian weighs the day's ribbons manifests and starts the calculations. 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 <= 1679; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 427 156641 -809821 501350 -341554 -542189 -792833 -981014 -667397 573127 630622 441617 835623 988 -810930 -177218 -201491 409533 -837308 907188 -194310 517218 -415887 662891 852658 897994 -57937 980822 -280174 143944 -932052 812623 -290880 -49789 115091 -371498 309174 384616 -503394 482914 896655 -490518 54914 -891846 58921 969131 659138 337718 -754867 -711252 -535487 -453355 628039 280876 627815 497560 338287 -632018 813580 -316382 334368 -458824 -234961 644367 226907 -546203 -577816 -733431 -982703 -335856 265383 308737 -495295 -102589 44747 -101335 618427 299909 683252 878446 987882 -168007 -609835 723613 120043 -6536 -652445 372319 677671 704346 -756840 587711 -223350 -630120 -885245 985150 -593467 344092 -76492 -966407 765134 135119 625595 -552826 296224 -392349 832070 205742 -498331 …
Output: 9

Example 2:

Input: 1147 751380 12160 349954 -820230 266614 822876 492974 48064 -546015 521405 -335473 811711 851621 -545967 -494076 93787 747970 801497 297640 -310792 -172364 460457 -884734 17890 40686 -45007 497850 -929869 288293 259164 486961 -834780 -287296 -803322 -926328 -771064 -207378 825498 -433859 107556 856767 -989096 -362372 15192 -256835 -497331 -560125 -153444 19466 112213 -834990 -109890 -909946 618025 -438864 -372502 617026 883824 -925454 400478 -701823 -202458 -61486 -180981 -948995 61132 -121713 -525510 -104076 529832 -35116 817970 -287965 -860366 286210 -278575 -861330 50950 -205224 224831 -47945 -285687 -695932 -413792 -85862 -354165 -963269 -902554 273517 923952 -842943 611967 -496259 -383328 -137239 -474375 -396110 530462 451318 312634 975501 402455 462273 86372 -459355 199230 311140 544…
Output: 8

Example 3:

Input: 1651 -392101 -920546 -534121 -756939 -422307 267796 -324996 -724478 991790 -292989 -83566 -244414 -480484 -701242 448889 -757854 839601 541359 -718446 -227328 -783748 987736 527214 649610 -748101 973094 -763454 -647378 -197654 -13971 291126 257381 397771 66334 662563 619601 -944017 -301284 719716 -519443 -36148 858002 -622170 94790 952859 877025 719098 191086 868643 -35491 360292 -79103 261424 301687 10681 18459 898962 -579002 -323595 662607 693942 199902 -284865 309317 -414558 981085 941792 -987918 550115 830491 -645518 881357 -843582 760607 348970 304001 -75237 456814 480267 -550026 625614 -177792 531978 651840 698300 41078 853154 516760 -99055 499017 -90083 -624035 -926113 -663854 959284 626650 -403611 -260291 406256 822858 997548 -702881 345960 -752490 -402339 -435359 435876 -14420 284…
Output: 10

Constraints:

1 <= n <= 1679; -1000000 <= a[i] <= 1000000.

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