CT26224

Zoravar and the Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

It is audit day at the spice bazaar of Saffronia. Zoravar spreads the scrolls records across the table and picks up a sharp pencil. 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 <= 922; 0 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 734 97 904 381 127 31 784 851 36 466 625 66 408 781 607 818 76 529 805 230 419 969 494 857 252 261 97 118 315 181 417 40 775 650 701 1 680 528 44 153 533 220 636 887 130 44 688 849 234 273 647 636 994 710 284 197 426 825 635 614 997 630 296 618 992 675 70 168 857 873 330 217 24 348 181 458 507 94 211 519 319 765 214 396 324 760 583 329 903 328 6 997 29 202 504 908 541 27 85 826 526 355 438 418 734 298 55 823 674 273 797 119 756 703 312 313 727 594 623 750 690 63 756 246 656 29 501 69 307 587 502 885 293 916 849 561 154 68 504 624 632 249 703 407 813 494 368 158 643 283 461 417 192 430 655 690 695 884 835 748 231 913 378 387 498 392 260 929 752 510 927 235 743 745 769 611 258 789 880 22 462 834 883 917 873 506 237 326 694 630 861 46 18 487 63 148 96 947 626 492 479 364 863 378 764 76 3 742 …
Output: 991

Example 2:

Input: 622 632 775 417 937 513 149 143 384 919 878 808 781 55 79 590 684 890 896 557 334 994 576 326 161 953 602 277 201 6 967 70 835 672 821 145 509 621 288 961 701 846 619 988 322 658 615 650 472 422 796 512 867 394 532 87 943 107 722 224 50 569 647 645 42 977 223 694 109 884 209 371 75 361 199 972 697 910 379 868 563 208 981 633 516 112 586 447 150 213 248 73 333 837 414 932 208 151 522 11 745 850 349 761 848 30 62 925 623 317 619 840 228 618 365 435 673 106 491 118 419 82 206 782 684 372 21 528 628 283 189 841 34 968 123 797 714 833 190 284 760 762 985 406 81 716 121 205 735 146 969 372 752 346 813 453 879 740 796 882 543 364 359 242 691 150 406 43 323 992 154 266 882 812 947 11 968 44 292 572 86 142 843 636 820 322 159 817 375 113 329 638 407 305 280 578 855 422 171 601 285 706 104 76 817 70…
Output: 986

Example 3:

Input: 400 433 353 176 693 244 515 368 388 855 572 707 96 26 244 204 525 512 141 610 969 683 890 647 356 353 32 743 124 360 727 49 7 398 446 793 163 601 462 587 15 583 812 481 729 787 8 526 302 258 935 444 257 10 177 788 564 549 405 796 31 989 685 911 76 861 856 934 452 780 336 540 894 128 690 533 625 993 663 699 403 743 957 910 773 459 732 160 818 184 872 201 559 330 503 89 13 18 341 940 79 872 848 399 425 53 642 828 427 854 458 932 829 875 523 87 852 879 368 105 729 364 493 949 633 707 805 146 967 897 388 971 55 641 159 918 62 98 231 580 603 939 570 503 443 751 704 648 962 573 682 575 251 634 135 841 836 344 606 84 388 725 854 826 85 44 260 466 640 614 837 811 610 630 219 216 941 170 42 829 738 549 552 635 209 303 359 847 90 219 910 482 36 779 800 462 690 707 695 293 332 86 259 237 217 179 271 …
Output: 958

Constraints:

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

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