CT27393

The Marble Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the willow walks of Reedmarsh, Omkar studies rows of stamps 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 <= 362; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 147 248274 405508 486253 461251 -754418 -373793 -832792 -468540 -100789 -618059 434503 393969 650121 -748455 942810 -133043 -234079 -97152 418727 848668 469934 390213 -847891 682674 73633 -887298 -126846 389450 504319 122974 581138 935860 -730767 636622 878432 -304994 205700 -30594 -705131 -47368 328626 -32413 249310 -277041 -708551 -158826 -981222 -648895 -308788 323608 495295 286970 213252 386670 -427344 672853 -387617 -546661 -790103 -926304 725191 942054 -547091 -679855 373629 411923 425819 -414748 -98065 -732002 261872 -92727 363075 124670 -365336 -227041 866036 -550606 -338040 103177 589970 855275 -812207 -42414 -53488 -881108 224886 -393922 297788 449063 -332652 -926354 11977 -900325 890029 -499077 954251 221696 -351088 847568 -314959 -649251 1148 544359 -679893 -707180 710833 63521…
Output: 1790354

Example 2:

Input: 83 -739312 478332 968375 86664 -548893 -495241 54918 948861 -270536 54074 -827844 -25963 -638786 -663969 -68359 215132 -124912 -741278 76899 -787670 540840 -119013 -409448 -108596 305923 -348011 -223738 58352 884107 710348 267826 -431438 125633 -853537 814873 517225 480010 207607 802948 -276370 -232782 -826986 -538432 622774 -630480 479047 949299 427671 531093 -80284 -37386 931835 885689 246430 -214251 929878 555454 -89892 20225 724026 963997 366845 -720968 -860702 -335484 -524389 -610694 -747679 708012 264360 82046 -982823 -255376 -989408 -81886 -640077 553244 759618 -784414 893627 988125 -685337 531342
Output: 1678041

Example 3:

Input: 48 360191 -886018 -722474 713130 925777 -384533 109384 456137 -936127 -866966 923096 317023 327117 -749565 -207276 -42931 -790914 19344 -867309 80227 212353 385185 850135 6151 904269 -984830 -861862 -168205 150196 -627332 92089 -544470 887705 84832 698781 369646 -386584 729743 -244346 -307495 471477 -507653 -714395 -559357 -65012 -629836 -760607 781449
Output: 1889099

Constraints:

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

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