CT30243

The Checker Stretch at Bloomglass

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the orchid house of Bloomglass pays by the answer, and Uma 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 <= 2854; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2040 139463453 185971943 107433989 309271813 893480314 713290721 525375186 398295734 568217134 576627455 813323298 304962799 140778192 253810078 56039247 201163790 890722367 593014429 702044577 98820913 461092585 834753308 425550322 934480221 456168557 711867781 166829562 174733616 727074219 562002624 342790125 689108140 770357211 115408066 589663903 258524600 817435646 526799348 811519168 56765025 400014580 953231206 283482000 431580601 533191151 751191979 157114395 663675519 932394322 905391415 208219498 275662146 79129318 16923847 101590236 977681261 800669962 276161442 951357877 568356950 652265059 661369526 482924182 242532790 274471628 419679540 489721579 280231371 44905181 102537058 707013121 506706457 553546663 786050379 164910505 87854036 730025870 3950472 761130498 843158767 9568…
Output: 12

Example 2:

Input: 1244 833065495 965325677 628624495 343869781 671812238 786986634 93790985 588851330 337406411 690905350 263461121 968275725 656636422 301110715 919138230 926747196 765319578 978224969 196282031 376015662 932416973 343372150 88781989 703957421 305267724 325007601 479479984 373502503 904435948 971330879 710884981 468230632 936426264 698275969 542033578 616373996 253922950 15717156 62984683 529283681 102635148 168422948 988217639 689198238 749155445 468433028 591548012 875467379 238217173 88331723 967876167 749875159 563274051 918462758 624045098 122480475 991061793 41024876 736811766 304082987 813314363 996568100 197034417 665897920 344928873 383565943 965593708 902860737 430090319 364271603 945107462 354991063 248369712 530627847 696038319 341754244 723205857 352429671 150961759 308382362 8…
Output: 13

Example 3:

Input: 1551 214708626 901760218 8456896 770595137 591125983 939439574 578091528 592987000 808354944 475855282 253148756 732129927 549954495 680613008 374995932 105949598 807158682 65891784 637022151 300771809 582799103 977514977 3911051 544580133 25696242 213299987 220623822 998169279 979513075 454699183 233889963 1648271 447321675 170921444 88750770 551304601 177828968 42176265 435698271 340417166 213154419 66858789 68647982 741522634 19546451 779088785 721127860 539079210 308110317 226640226 810560519 250375438 33735001 235025121 52685917 657429024 888999902 977612031 975064210 568449509 751325877 882354978 963601016 874587715 487323048 887385266 663904950 736167205 256698224 531742569 963893509 460777947 590056678 360406176 265474627 650045878 409220185 815968919 196359038 687496070 278192896 …
Output: 11

Constraints:

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

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