CT27428

The Checker Stretch Beneath Gearford

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Gardener runs the customs house at the clockwork quarter of Gearford. Today the books show a list of stretches, and the numbers must be worked out before sundown. 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 <= 991; 0 <= a[i] <= 1000000.

Example 1:

Input: 477 426307 475786 806335 922749 738929 720544 881759 234426 279407 514617 707046 110078 395317 337486 52687 242106 751442 59269 471009 605265 917098 349793 871245 572934 795354 442593 227248 643632 189281 216026 724173 972348 568165 768072 328333 841813 534769 377464 354142 983000 88868 638137 38801 877667 411742 969005 212550 418721 567624 976043 678512 703272 871761 833924 781257 878166 194688 457393 100471 892013 909163 410963 723371 776452 984267 454443 87120 168814 195382 516058 104356 257870 220415 711461 315757 794845 588213 143346 589670 569942 183234 703911 689448 690646 204075 172784 337825 925323 536640 607555 798332 543482 664384 34927 538294 304688 69472 34947 61244 770757 729055 395915 56358 690842 596190 572088 830979 316834 168502 240314 779880 464785 110360 590197 985021 3…
Output: 9

Example 2:

Input: 694 887303 358206 355786 432555 388614 23972 718082 24372 830550 49649 139943 239975 368856 853168 572571 132821 639729 470541 450673 57601 44036 545840 662845 156142 876711 655636 417304 77464 773582 758222 342944 56592 196586 945060 670933 900056 471974 346167 420996 535564 40126 201353 877314 606045 631754 281037 133252 598937 993428 945310 709737 851449 435586 876812 471571 972057 798718 123901 768529 993198 535849 175504 950156 527273 450273 512836 921606 236012 677180 115901 804613 115068 547753 22915 972541 310224 530950 711399 291109 896802 653420 406978 132884 933997 676869 491669 581520 586335 575199 260932 519792 111675 46059 742419 517291 164677 810890 69687 957300 807741 940225 718374 737447 198886 331734 558169 974750 886768 86736 783082 586805 346367 448614 850243 783329 778…
Output: 9

Example 3:

Input: 990 793128 557728 773794 887827 311054 859815 975842 320283 87987 820824 502797 787772 368057 372882 15752 103381 102778 956890 329748 914580 626157 442057 768407 780529 280336 879300 244368 566244 770494 501955 881413 607109 593178 867917 127552 798883 811533 892082 531550 649910 658631 564307 339305 339488 111302 899010 557330 803700 271654 412058 157101 994158 396431 36387 140044 582805 198299 338872 151460 539427 372017 44101 213774 968929 897044 725702 958275 462136 144818 442733 321573 449421 374039 736367 408687 951127 801119 901146 185132 410120 887148 505200 979018 300541 548680 735047 898222 369851 821356 805545 610528 810549 700233 7920 189916 398735 912678 771196 743485 818016 736799 466332 714454 172003 824762 79784 115176 730427 777357 269471 444746 7003 130274 95413 509915 4…
Output: 14

Constraints:

1 <= n <= 991; 0 <= a[i] <= 1000000.

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