CT22111

The Shimmering lanterns of Petra

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the northern keep of Frostgate opens only for a perfect tally of lanterns. Petra means to find out. 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 <= 316; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 222 282578 718873 122389 361559 639535 490508 137502 730061 667180 441909 489345 740815 559650 145817 894396 304609 490176 767991 275926 641244 381074 364524 37465 38210 852550 491397 953825 915487 294501 628644 50268 796309 723671 774152 277431 177058 341265 139572 237401 249808 692560 587471 96648 953427 602056 367351 65994 98003 418927 620957 367806 316703 50402 560400 805726 706013 909 622601 437721 577065 842837 756533 629885 286464 694668 443821 692308 673392 644677 933779 471280 752205 970508 901403 437126 479123 196909 98812 750185 591324 487165 170276 565389 871824 38399 120566 865297 677852 387715 228258 229753 398492 917637 170617 383042 923753 883457 941637 911060 984967 745244 629559 425413 956368 393343 289403 959865 450877 930455 735681 561137 473871 517439 456445 272827 529…
Output: 922198

Example 2:

Input: 70 379608 402090 373683 539186 299836 940890 801090 146983 595289 30904 876610 197365 753912 610083 596819 756393 534809 9616 419918 34646 419105 206112 537849 11104 549527 32927 307344 492068 36199 48177 957686 705094 29822 128439 980997 897580 986301 641241 544680 791964 855817 258693 164439 629106 953054 796298 744296 253312 344081 274020 403618 846353 63893 494357 767836 858612 31957 625069 309968 448644 693972 255768 473087 120693 626704 17876 749644 276907 737038 975721
Output: 909509

Example 3:

Input: 304 104684 46040 809481 15014 455647 562033 342881 945669 191838 228972 108170 726496 290584 777866 871521 67803 727997 404295 945339 654064 208237 272713 764582 870207 301662 919774 370826 447921 470034 904723 427248 759288 212876 426432 196315 919886 705900 872421 444824 835871 467055 577372 929726 287667 150172 639424 20279 559668 487975 913613 755387 943809 499532 157083 837464 235817 342993 718679 385151 932024 811492 123676 930497 289082 405811 652919 517292 619138 743407 940864 566905 742712 950216 656537 698831 551244 202538 653355 997330 29313 772243 929175 919778 149150 134436 147439 527606 164805 678556 743245 322722 739364 217018 199333 809533 537398 961928 658023 770360 821982 820289 346547 367882 13536 337582 296171 113302 768099 703573 354489 916451 971470 62830 598373 43254…
Output: 968017

Constraints:

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

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