CT33968

The Checker Stretch at Fungaldeep

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the mushroom groves of Fungaldeep, Tracker studies rows of stretches 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 <= 3547; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 511 711138102 994004417 705015688 129860366 24786779 364280013 662387351 328756010 947076401 223621870 86998274 127805965 447885076 793067413 322017927 244009340 654894120 364519737 565198677 767949706 416709571 922523824 199280822 564123995 235229339 216670655 495440194 500235578 757577535 335431075 690588836 914600280 916599147 781062136 44782800 750830475 307617247 675188290 571463716 720748622 822116378 428727607 342340042 319890152 438504886 129519673 835446192 121943219 977632308 986730881 317161308 779357231 1521872 163944365 670115552 332283132 416735444 958956247 814367930 888200245 890689039 952959680 558066467 582012552 89281776 388160099 515847819 997521316 99925362 104369732 808654371 689353371 798833069 801564704 897813592 516881096 130227985 512372420 364389175 228128015 697…
Output: 11

Example 2:

Input: 1698 44835798 58376457 536508230 303831269 369382375 678361915 286789712 247989011 794946327 495656325 83661475 881518613 30041914 827195235 579655697 717513268 219273085 452760699 395245304 882890940 193503405 349490401 726702983 865471780 622763771 490583426 512782616 676737613 716400300 9179224 524051085 983637752 428200244 147922182 829009679 360827072 297244761 843312485 262842179 559556815 830353957 212810986 278833531 956774519 281366733 224166126 665866504 611256258 262667909 507679288 721056303 439079830 18981191 392537506 611903547 180621053 24990637 900346426 878330994 253854915 477450126 381868547 83580323 76937803 465780312 895070631 954861389 520845985 979471689 328867418 382266920 671166032 965883721 69398598 508316750 953736990 469397922 558525469 585613977 3006297 80228872…
Output: 14

Example 3:

Input: 2198 126892317 51944236 621705012 551311560 622779688 812539006 634296982 884178463 452417078 898348977 685224081 39949643 74641318 399660640 338238758 837430670 879220822 827458214 710321556 142923807 94315412 223432247 871386176 284076285 123939480 56098224 601989212 483540999 490338737 693075710 758366529 559751883 439645690 207221007 129322232 480589582 549051834 994257473 869752441 860180006 718459431 466945269 357357050 629147410 743191972 720702100 112627552 99963150 411900016 982035747 484868373 50026306 124553873 713405157 991969545 240779661 679457642 433619372 606906165 813971009 476133266 167656972 788024444 864812313 657444645 586655155 643282815 340935386 745230447 947565941 460393901 820790603 431016659 518024862 512430473 223512953 416150551 109533869 445216897 759492081 99…
Output: 13

Constraints:

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

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