CT32614

Quade and the Checker Stretch

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the shipyard of Keelwind pays by the answer, and Quade intends to earn it. First: the full register of scrolls. 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 <= 2119; 1 <= a[i] <= 1000.

Example 1:

Input: 1182 233 139 199 201 281 96 335 760 684 379 314 462 844 275 340 645 59 199 973 346 762 678 829 417 704 315 332 489 830 70 360 642 505 220 95 328 645 838 138 227 563 612 668 479 109 340 274 291 291 978 305 88 837 995 195 247 856 365 608 714 703 901 842 248 502 243 376 772 650 60 923 712 245 592 243 346 571 945 269 258 291 560 138 852 389 453 653 754 932 488 876 180 201 759 369 876 43 486 943 242 918 45 591 635 416 598 913 546 211 343 571 930 805 297 73 638 979 694 943 500 544 840 89 629 794 295 55 248 301 895 885 794 496 65 121 563 674 811 741 737 509 589 939 401 53 609 824 274 388 501 872 418 40 406 986 598 747 4 511 220 623 59 681 760 635 279 530 502 393 340 946 421 374 549 959 338 720 98 731 990 557 328 495 593 816 959 728 659 686 965 797 426 424 775 729 433 609 528 300 367 213 93 158 38…
Output: 11

Example 2:

Input: 600 707 993 398 941 911 723 787 592 248 330 987 481 209 375 120 34 187 59 978 543 990 425 27 207 619 560 442 869 676 954 56 404 224 629 522 896 987 352 307 477 553 358 134 239 117 792 623 666 816 270 521 54 800 174 529 211 789 284 899 897 563 757 386 226 687 629 130 370 752 703 610 330 740 344 280 704 348 919 561 3 383 238 57 7 759 161 911 719 303 796 575 620 231 55 428 33 951 257 797 823 184 710 938 44 641 861 51 574 596 289 593 432 359 958 717 734 745 766 892 98 444 92 921 143 375 810 328 407 867 370 723 141 911 30 88 569 527 40 610 7 802 866 961 988 412 737 16 727 936 829 482 366 322 237 863 654 556 475 540 510 28 663 473 9 984 519 350 426 636 836 360 874 539 484 555 781 246 779 674 62 372 250 581 653 822 69 796 730 884 211 356 789 307 219 373 334 82 788 244 899 116 421 973 18 288 705 7…
Output: 8

Example 3:

Input: 1794 204 226 562 166 254 377 764 181 86 339 19 469 765 307 336 433 379 199 444 886 9 132 952 105 626 62 731 328 991 369 851 722 512 651 745 219 251 784 861 333 719 151 864 685 362 340 329 918 321 880 858 292 931 879 706 52 827 14 300 322 699 967 202 471 879 563 723 23 743 462 241 342 600 826 282 85 509 515 539 893 846 410 477 839 766 937 764 192 211 244 267 458 535 513 744 646 228 992 936 739 399 286 777 866 553 351 285 33 882 53 551 301 990 939 449 394 595 172 154 673 692 766 107 951 620 719 272 213 457 18 688 424 628 880 983 846 797 492 25 678 76 56 559 531 859 894 226 717 224 567 184 647 445 750 210 118 513 545 198 204 363 6 436 843 931 521 369 942 731 672 849 573 337 832 427 940 535 227 773 849 454 508 103 376 974 68 664 726 265 433 111 956 454 114 442 239 38 297 988 297 201 605 446 77…
Output: 11

Constraints:

1 <= n <= 2119; 1 <= a[i] <= 1000.

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