CT25351

The Tempest Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the cotton rows of Whitewick, Iris studies rows of scrolls 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 <= 555; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 391 946224 254187 -56379 -192823 156100 468627 -396012 -965884 -378917 -716411 -817902 -313400 -749407 -602081 -794605 -328189 251143 958732 231360 -905979 664197 935072 -38630 557559 -718291 680598 907132 -871237 -585163 973416 373886 31228 -152633 -647582 817283 271300 681850 759776 -556410 248774 37917 -635615 551515 21920 451214 344145 -780379 634809 18018 98414 896891 -765200 202389 -851442 868510 -287926 -712355 619719 149593 291262 -982350 490059 -116732 -57431 348633 323219 196512 -849799 -182480 -493240 764731 -317126 802687 -384382 155433 -656471 182134 81687 -173055 -359179 -395862 -99598 -874688 -675072 428237 319649 770613 -107822 630881 -259377 695476 837983 781465 902725 505737 -665243 -512968 170172 389169 -828042 -534455 439350 888520 207518 327063 -822939 420700 642959 -6…
Output: 1932196

Example 2:

Input: 345 -551024 730826 -42430 829598 -95215 -364477 -517726 -607325 -2046 732205 -544237 -693848 -68323 -710587 910135 502757 -354427 207573 -581738 183396 -934888 -873384 42668 -758993 86295 921494 -643614 873707 137201 951702 -395319 584454 600913 391568 694534 575520 632237 -31659 -691980 -354717 682579 219408 -634367 513626 691870 -873252 654171 124532 -55043 487663 -845189 5664 -298688 -810757 -484027 992581 817473 36349 -550511 -502953 -80486 -431346 -845155 723986 -52627 -208273 698487 655914 8304 234609 263820 -748051 401429 -230624 906324 -241310 787909 700988 -254096 547264 805090 377840 996566 385954 456382 654650 -852722 -865626 -662109 -87080 569795 -198483 -27420 -18934 881182 48230 -551444 889323 295377 308596 172635 -778819 912907 131151 301364 -632766 -80033 -949266 347038 -20…
Output: 1973479

Example 3:

Input: 249 663876 -479657 539838 972020 813980 -863289 -143253 -416369 700744 231194 164905 650751 849446 -855667 44113 -697486 498209 -218880 315302 -314302 -180087 -597284 891775 865000 -23872 -434633 -451412 315684 -219724 -75917 249762 445567 58388 142963 -69692 -382931 -142111 622956 -227829 -544925 -286970 568474 654648 44982 802385 -492534 415534 -88908 -511292 196526 169154 -509556 -289296 987529 971266 433509 -564654 276086 -448108 49641 -810899 -20113 -37580 -582592 344631 4797 -863657 -6318 -120148 -380056 814037 712023 -631090 963875 -797499 6455 -120927 -621334 308873 799602 140432 992866 -192317 -864626 874537 706000 -877604 357013 248101 -209728 -889006 -140098 599977 -352654 183976 -887217 -623665 646578 220518 341312 -79987 649321 -123576 -510317 31609 400133 896379 -687520 -6959…
Output: 1843163

Constraints:

1 <= n <= 555; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

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