CT27531

The Checker Stretch at Cinderline

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the railway depot of Cinderline with crates of segments, and Zia the log keeper must account for every last one. 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 <= 634; 0 <= a[i] <= 1000000000.

Example 1:

Input: 527 292136517 295040339 35225762 68465580 325972855 823002614 212755975 651023717 985332945 540797909 210738146 871862991 313823257 495688493 148370176 747662087 128217377 593585331 795369214 985412161 502124737 750505769 869014158 220220791 261513503 28805047 978858416 278027118 535606304 615677163 497184031 638825486 420991932 303427691 640667931 56336898 883849236 660066514 246646336 672821130 275178321 247485684 470444910 605808571 768398113 965911999 534939268 863819095 832271794 784480716 819335579 279064463 244884498 512566091 526236250 361714873 695236810 125964560 893980310 497573904 388148983 539254269 372121778 192408061 295759359 807247950 825958591 304953698 391490626 482999848 840246203 359541953 541995333 474340002 172819616 41082239 229193779 208071216 525539667 213621330 5…
Output: 7

Example 2:

Input: 130 976691855 873528620 40120396 614223858 902967435 637979907 229535817 808978810 69601733 339782665 218418223 501981021 798391799 322827090 221415122 149973019 880396411 304894161 718213058 335599547 971466142 844028349 697864445 861562788 897311794 750534871 170603445 436888456 267890963 122060233 571263153 103853431 290279397 445501742 296264221 202444075 205947036 942878956 265246737 463494977 51237663 106457277 298387108 755900692 645648197 636445169 173513439 641740995 719070148 925197286 388718872 699017899 543464474 820351091 924041173 927948189 375887089 327458303 446835787 292963101 785991824 615759195 836638786 903412693 38645582 485809423 652172097 791617621 182707799 684309138 754171728 209292095 499541437 785170257 715290337 482631989 846545890 920717109 536993649 947094617 …
Output: 7

Example 3:

Input: 116 823030909 684549188 435717948 165510252 112324801 547971651 729899318 669393057 349052184 51206487 451064831 613901354 476550645 548827289 703051996 126193602 420766691 201478219 747873796 518485702 265927178 272644249 317792632 752577921 207546880 746572260 828465629 307936739 457996075 946764746 159390722 658383034 123090383 517313864 440993427 525424321 492273779 190309707 343394774 55616394 756180060 594663167 322415206 443339539 742691579 828996550 428009388 454624285 892410600 22446680 984726800 145752205 917422504 952669790 806580236 163989295 156967154 782778584 892504687 558863633 790136257 594774285 394007152 932166943 960932901 572624092 565448448 253401885 54230903 216369022 913715032 590446516 294406809 843450671 879847909 57376433 396898461 338476055 711017667 224648548 7…
Output: 6

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Checker Stretch at Cinderline - EASY Coding Problem | CodeTikki