CT34112

The Checker Stretch Beneath Whitesnow

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the tundra station of Whitesnow pays by the answer, and Clerk intends to earn it. First: the full register of windows. 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 <= 2192; 1 <= a[i] <= 1000000.

Example 1:

Input: 1070 524862 260591 224549 943411 800330 182493 205858 717705 238739 809160 868005 689516 664552 759310 138821 197972 353178 644078 835016 640596 415390 996195 113226 547557 916074 45704 839766 504296 275898 650275 197382 654034 885206 78446 817668 279745 716261 966123 324011 702532 294734 805056 476609 615851 660757 498302 794721 263518 946976 423818 465462 995876 775812 717069 462409 165062 623863 808910 224620 607876 336363 202971 987310 485903 256965 755593 396477 482412 578347 828147 338230 162160 922776 266375 215209 546854 188209 889334 681334 686987 843791 504296 943673 474740 474375 992490 821658 207620 372669 25792 50721 637670 260940 966061 894312 746459 253398 871892 977694 73986 272120 563043 400400 44858 62113 407024 771917 468296 687651 260899 855911 985252 119187 102850 4946…
Output: 11

Example 2:

Input: 1723 607843 637351 17691 588960 150426 576617 684972 81464 724318 983253 589728 112082 211631 722159 497762 277914 896811 364567 606360 954786 232276 464449 960182 879107 797724 436230 307552 516549 426306 476978 754424 801947 592586 109770 988634 317460 810445 719086 32095 597508 507668 152715 850082 193575 874958 251473 260261 243890 167607 777276 43381 308765 983707 236048 205651 150239 676035 445859 407504 452482 25960 245544 806807 592760 448781 289354 65317 786114 497322 738774 931572 957144 652962 786078 822452 6027 250032 628558 777600 528395 199276 359369 244439 631129 867790 326096 613959 147441 695315 569097 699387 48931 858893 673847 65269 892440 527092 555449 144616 805839 484869 156608 966627 451689 238793 557996 732512 290901 833317 23319 537107 939964 346696 662322 984618 6…
Output: 13

Example 3:

Input: 613 97786 295499 691775 808023 761306 438562 8446 820394 929192 826073 745841 737069 311200 807709 972641 946332 543953 623885 624611 128920 326367 599033 922773 625636 183825 316675 776621 50717 462328 643220 670022 546045 213462 168630 23330 644630 71640 430381 842514 852253 692169 557018 157931 459690 853479 54972 834472 437162 945977 185863 769562 388073 78748 600991 520626 197658 579065 978200 535141 984960 353851 861542 178196 104967 996685 3492 559515 259508 783075 488293 180349 140403 112923 588223 589694 312038 754565 806975 200396 335033 932617 18232 506856 277566 871714 933550 986906 7607 780292 407775 484205 562304 851379 142730 121355 771448 362594 506354 157578 791470 965014 399620 522131 300409 330009 46569 943594 515418 820202 492632 61146 465335 943655 16246 21619 464612 3…
Output: 10

Constraints:

1 <= n <= 2192; 1 <= a[i] <= 1000000.

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