CT33183

Garnet stretches Checker Stretch

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Tailor the surveyor watches over the sulphur springs of Brimstone's stores of stretches. A careful computation stands between order and chaos. 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 <= 3182; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2981 551976981 87039953 57115141 796044187 279943731 853308810 345133706 626892996 837120776 591813223 347346699 356380464 516200530 414748633 384119257 374151422 322125424 555880912 426291845 352908632 875725976 172035973 903544982 286625606 145403265 825562573 745085031 215264248 446153918 861693898 352554894 639434719 914945921 807167421 552325370 575061246 97085828 718514685 142323273 425823379 719799157 994489151 362489623 804716595 909792150 381484242 137008984 521291988 833111557 287790021 451445010 634397102 147380382 246635585 80748298 972104354 232511798 896185717 632389618 241005745 987944109 450938987 385741600 76510986 642652276 111530151 915714442 723359792 493179291 397529723 390846859 678305745 444895442 758158040 47651897 631052558 413400939 169258992 108096325 970091551 2…
Output: 13

Example 2:

Input: 2312 576154506 696554285 484037291 230501150 311584930 2589511 870080147 770926903 865277343 27778390 494208638 303913198 320589926 186162554 906500848 966520520 695894622 110186110 689097049 339434191 161101113 136722374 82874025 334043864 124504107 631394035 568771358 238916992 592617182 183611166 590032455 809498677 244581853 226490099 379877332 164594907 729517533 973369476 352719374 953935797 850257665 311331768 54476188 292775345 279123557 884137979 255752572 439879339 924074034 148252277 2905910 218385805 290367377 816312291 280889952 544683352 823969582 929271519 727694834 963454508 800335688 77359042 60725650 312996291 877018351 303213185 526661429 199108338 674081376 703621426 134395256 170106563 965229499 650814229 341980592 415732431 816980183 780482858 345205926 749592384 8449…
Output: 10

Example 3:

Input: 2096 144398554 603294936 189828810 332417258 216817110 547075368 772906257 437539496 752961784 621707155 565799598 781848631 662418325 634692422 957580097 588066751 727803441 838414225 557260706 227032124 227058106 262246865 344336989 878436061 114859 15761507 720250974 918171255 835863967 400287545 447445016 731539578 852776498 611580137 50890305 792968229 20351562 497048683 797866370 553522215 803977927 987864161 397865336 435542474 983962180 954728588 163989485 383654120 575058160 556340530 410397473 994579706 904815591 128906284 20953749 248174287 41333453 511745495 753463103 445862117 401960642 245448572 18157804 439344354 209358329 474671059 986064873 354763840 538215674 586353142 284197145 883329958 613277598 571307138 487575627 319273599 33411430 22464243 166324497 229347897 608815…
Output: 10

Constraints:

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

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