CT23572

Mina and the Radiant ribbons

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The council of the windmill fields of Gusthaven pays by the answer, and Mina intends to earn it. First: the full register of ribbons. 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 <= 1668; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 176 806180483 647394177 155137938 867684440 123775586 617373953 657414640 828318553 724219336 346108552 206575856 637362771 71409345 412440209 393502293 769296495 41125205 31972812 121616320 738852838 539794838 901498633 980851091 976474015 102075028 233333833 738013620 24235662 318115782 99269898 181340076 694910411 342675281 188393280 502555328 20186473 354396301 105618706 703888576 188773606 520020745 809483618 957785449 95627388 916143669 601847376 957752676 289251110 766505959 792297046 107815370 349868487 936252990 675389055 86162899 570027810 879056491 407431595 725217134 431686112 334298756 329301561 9431452 392982702 663492623 892604862 187449776 44628756 474305808 967065557 148280738 286441229 507457416 535714193 224964109 211456491 603844156 306075303 219298417 438398434 5973112…
Output: 7

Example 2:

Input: 378 971475801 252422673 743727161 210119497 255730798 143331877 878613536 491251048 675152855 309689186 80059296 726046083 371616282 571719039 428509119 22440900 826596531 469022857 309421665 171194764 414577584 419049075 386924223 543763975 168042352 197612214 850069608 921773245 344691390 534465912 809889529 997183156 702674602 816371139 14608137 157196490 802756252 104025084 368660461 881837065 148078252 315577312 61327131 488942579 579972026 347658115 409445841 475124952 953931412 378447477 75920523 187404418 624621423 68123509 221092303 372619428 110720877 376173537 864606576 576486881 61178251 757324615 577302042 302300473 379154430 63563310 454581277 189928626 952088309 361696157 299083373 544170759 508380091 501356726 203516627 978872209 930310036 59170958 317528617 943568290 59220…
Output: 8

Example 3:

Input: 153 707847664 992255720 241486883 808532359 188270269 130284849 683381500 142083204 851056676 460291304 211274869 202067546 675545463 237039 248881916 219929508 549723455 472328570 2943935 417217579 732028207 312727594 818847194 388801380 985274217 826722989 796121063 677547689 832635912 139084059 652943912 535235068 526105329 992231947 667032711 292315363 549287375 839882209 247374224 772219034 994035324 20077628 194634564 952262597 671490184 495340338 929078879 978677763 93480918 782128995 682234418 315219492 452573003 616964065 713921404 810977771 83779868 815411060 614776209 641612791 13121072 991447151 802359721 334966083 94868935 295174967 119362122 900804998 341229436 232600845 585379482 997261750 89198527 399088142 809743429 942829379 299304665 642343962 900034166 287176282 5507027…
Output: 5

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Mina and the Radiant ribbons - EASY Coding Problem | CodeTikki