CT26870

The Largest Step at Firefly Mere

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the lantern lake of Firefly Mere, Ojas studies rows of lanterns entries. One clean number will settle the guild's oldest argument. Task: Read n integers and print the largest absolute difference between two consecutive elements. For n=1 print 0. Input format: First line: n. Second line: n space-separated integers. Output format: Print the maximum consecutive absolute difference. Constraints: 1 <= n <= 993; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 206 567 -29 467 531 11 191 342 899 891 721 832 538 357 607 129 88 253 909 736 524 776 200 386 33 773 573 964 294 505 5 982 109 105 300 501 142 997 895 -26 971 386 484 664 153 137 309 633 678 488 -94 26 959 -8 856 612 676 116 754 143 759 366 177 809 391 113 596 713 -64 -52 204 617 907 338 784 921 57 665 203 341 534 324 89 492 776 644 658 557 145 472 910 288 743 116 33 779 619 95 700 585 -26 870 639 556 707 929 921 559 695 248 973 759 902 342 111 965 205 200 870 478 455 514 236 577 823 463 444 397 759 392 676 200 396 170 973 898 -84 472 424 583 458 -93 430 -98 758 552 403 683 76 898 230 928 263 -83 428 751 427 870 302 -25 97 767 858 565 724 154 809 880 19 203 374 722 673 -3 458 -57 180 843 115 759 155 974 646 631 204 -11 716 761 600 718 17 574 99 71 907 904 149 866 69 986 423 854 89 391 944 …
Output: 997

Example 2:

Input: 287 567 175 -25 752 345 842 43 623 386 616 -96 484 276 908 653 426 -55 696 152 525 884 627 73 634 370 505 -74 13 255 109 741 739 870 374 231 687 83 304 615 975 223 925 203 206 582 443 195 123 605 661 -11 91 -32 760 -93 242 124 -91 740 811 -99 403 395 77 364 876 176 790 479 886 -41 749 510 750 611 948 178 782 929 70 528 431 12 820 898 335 -79 368 -36 -66 94 322 823 266 822 31 486 -48 935 970 233 875 -29 -27 111 658 383 551 779 894 180 36 -78 863 602 306 559 476 397 -28 473 -73 880 187 827 580 178 242 40 711 323 866 -82 731 704 828 566 106 354 397 121 787 344 479 696 313 12 629 146 179 688 573 789 357 353 704 85 521 356 563 470 141 290 255 502 948 780 620 400 74 -34 517 690 938 996 376 964 446 498 270 154 998 677 309 791 897 424 861 -18 92 760 -61 164 334 243 832 117 335 897 927 310 367 153 …
Output: 983

Example 3:

Input: 141 345 501 932 942 918 832 533 441 948 453 510 538 458 -16 602 655 833 897 186 -87 166 687 492 370 761 270 62 769 846 117 948 317 35 196 592 -7 137 459 436 297 382 33 410 860 123 721 383 -58 288 363 319 424 -24 989 821 540 -63 981 531 188 955 884 356 552 263 940 142 640 711 446 735 760 343 954 -46 310 486 680 354 26 940 9 749 387 938 451 494 928 87 -8 251 965 894 -97 414 761 857 108 656 522 32 -58 157 28 728 487 488 191 189 925 310 102 671 623 -3 702 -94 771 928 987 66 905 855 951 -31 4 277 11 884 565 442 40 198 51 727 768 265 -44 598 634 371
Output: 1044

Constraints:

1 <= n <= 993; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

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