CT25442

The Checker Stretch of Stonehallow

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Before the gates of the granite steps of Stonehallow close for winter, Devi must finish the panels ledger - one figure at a time. 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 <= 952; 1 <= a[i] <= 1000000.

Example 1:

Input: 861 120786 36596 610268 644121 256406 306329 698764 621817 915689 578077 281802 322586 446155 449642 589443 605406 552784 210680 677762 491548 794300 805390 486614 156355 865422 601762 736017 617270 385373 851366 837580 242734 382306 743438 860111 393611 385364 639107 53218 994506 859410 162823 362667 469364 206449 168146 838676 266280 585588 172161 836583 862788 386136 193335 240380 209240 739755 77896 490982 671178 924430 979456 983758 503631 692646 106130 106094 448518 441576 159498 419078 305666 48883 348353 253576 113228 486840 629414 580221 471007 332431 66469 471542 714019 159295 763719 884611 883781 76197 862039 345420 418708 615067 836603 273440 680844 870931 528437 807492 683704 593089 986170 683083 660954 69245 20916 609706 257003 986270 39647 775591 389213 168592 570665 619747 …
Output: 8

Example 2:

Input: 505 958117 934618 374289 668212 566607 630312 839279 586601 253299 164555 658142 917365 937157 690369 179518 801441 428272 237234 607431 807484 727925 845596 316865 582934 681749 452137 535264 894005 404179 172559 650770 571553 356353 615276 625046 865286 658824 928607 678463 856632 112578 803267 724928 978715 101653 701508 101572 566963 187071 476929 717602 350995 310467 598884 683326 491436 472978 176774 676141 267331 124870 719557 921905 938443 904005 516103 281449 243407 416534 468037 736877 710030 985279 574150 854577 962513 318789 854466 59142 125366 792235 145938 722831 642264 125372 258679 964708 907516 948742 626918 370656 413354 312093 574098 742642 444906 772402 798273 894557 582600 161545 610391 693216 96046 354863 120725 321886 669919 777101 579699 744555 338736 281830 169107 …
Output: 9

Example 3:

Input: 325 627776 858568 962692 536532 430971 915018 318659 256690 264965 549219 368233 857791 27977 650184 203572 913108 918736 461601 940712 870498 167451 682381 735620 789706 38322 989677 182148 63650 922653 797178 95499 35104 240715 577346 733843 138814 63056 150520 568948 781310 112721 534409 702237 372365 645243 963701 183346 46408 927266 962513 806114 978397 656396 555203 220629 686735 856746 689100 781594 882790 737837 117985 992599 162264 537019 879043 167151 902999 667421 807896 472708 410204 307469 965842 381042 177240 894904 698796 958830 311630 235577 299415 746473 749735 97140 518242 384852 14251 901736 679899 859291 935422 860322 176217 559474 726723 832619 113034 366896 166293 361262 870731 491306 835599 9959 557956 792576 304318 409906 152681 194473 444532 579734 802959 33796 232…
Output: 9

Constraints:

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

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