CT25237

The Stormrest Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Nils found an old ledger of scrolls in the boathouse attic at the cliffside roost of Stormrest. The margin notes pose a precise question. 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 <= 378; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 132 -595204 971255 -715470 -985411 158949 -845919 362643 232020 -178906 925562 -838335 883066 164546 525820 -87842 767118 -349677 563597 832536 -414455 713195 438195 657087 235941 295363 -839485 734225 -271 555162 -48871 -392136 568856 43756 -493551 -984753 -687563 290687 -654246 -411325 -264561 980578 -402354 -667117 -151747 704570 361270 -309019 -814080 659929 -325495 -840031 559837 255373 -44914 -75299 177210 -19018 -73201 150395 -352064 722476 -394014 -794200 93691 -978457 -648074 -620568 -451674 548467 622790 -718490 -253268 482927 -731315 -294637 -393648 142541 773428 868623 -311135 -676660 -409935 617168 -537323 -168180 -659769 17859 -28558 -420613 -599039 -352248 -473945 486845 518919 -115827 -889046 -220316 87396 -551059 428030 -220114 -868077 878877 -871939 253211 195092 915651 7…
Output: 1763897

Example 2:

Input: 167 -914584 594295 523678 827084 144053 484349 337254 705530 671007 325497 -292855 -315203 920657 -899571 625611 -758511 154515 -986840 42316 -365831 -58396 -983575 78569 519648 987644 -341261 -409670 958966 646192 575561 475241 109494 -710665 388442 -898461 -916996 3760 -857307 -878514 314106 -245079 377414 251752 12664 401158 217438 -662702 477318 995698 -322815 816467 -535420 84270 379496 -790876 -295167 -286543 -140800 -625851 -457622 -264130 263999 667413 672368 -865292 234879 974808 328648 802862 408312 -13015 -794288 270817 104724 -105644 -290263 -41598 -297751 -534844 -506258 -83257 -982662 -76885 -182531 570546 -213547 -759287 -787524 -203245 -788763 483553 -690951 113390 348126 204766 -27527 694575 171281 -176246 501163 -392325 217151 934023 492803 3670 132437 -890842 -735284 -22…
Output: 1820228

Example 3:

Input: 161 28100 271655 -301135 -695366 479179 -370285 454200 907222 92632 -495619 363642 -463798 289712 -683842 948988 -279716 7015 146830 639350 236824 573850 -59065 721379 -966919 -180213 -660937 -163964 -295893 206105 231058 943928 -940866 -623252 162399 551437 92113 -343977 776014 434614 -742879 423487 66530 869191 -912508 -541021 211151 709185 94893 -730764 759737 486512 766635 299365 -171817 65051 -561430 224459 -516488 546607 -172093 -122213 548181 -56280 -399725 -203695 343786 -184780 -815632 -587926 891515 573131 -914580 664497 790941 499446 -939596 -79812 -831405 903690 -636786 512804 -960 -842355 -316327 -799121 202607 628826 887082 573912 -301319 127198 429214 -764597 -320393 -501757 -520453 -381695 -124864 -538354 903269 -675579 725210 711998 710973 257056 269382 972727 -753498 1560…
Output: 1884794

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Stormrest Largest Step - EASY Coding Problem | CodeTikki