CT25996

The Violet weights of Shepherd

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Shepherd inherited the apiary at the old quarter of Brasshaven along with its curious bookkeeping system for weights. Time to make sense of it. Task: Print the minimum absolute difference between any two array elements. Input format: First line: n (>=2). Second line: n integers. Output format: Print the minimum pairwise absolute difference. Constraints: 2 <= n <= 887; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 404 495987 -242219 -362084 -741460 3112 -110981 541698 -451876 989562 -566510 280001 -269942 180559 647980 -411680 -51925 -604533 -887903 853794 9959 488371 -509587 -782368 -788570 782899 360285 -308134 865508 -557299 217060 -244833 593102 -705135 -662014 -602772 -2076 744183 331482 440498 536258 470554 -895903 184560 363507 105591 -920720 317459 532831 -605796 938116 -122086 -385560 121405 840488 978281 690276 -37274 916957 933499 973238 -655542 -645438 -925688 -94059 752556 -938653 350084 -755205 439577 525040 481223 -134475 -355690 -461534 -234025 -3926 -712236 98240 -537297 209223 -417488 211328 903745 -325268 -233813 981183 -277199 -696748 -849390 -999904 -371003 312986 948473 -29694 675467 -309657 806981 -702460 174055 -495937 713530 -283713 99598 -596411 193461 -535704 -133186 -4072…
Output: 3

Example 2:

Input: 310 783334 527826 -624894 454223 -202291 480139 221482 812663 -606166 -680400 -64045 140957 -275340 198708 62113 -574807 731274 -485714 215407 572450 -405832 -291609 423599 711953 -573793 -5204 -466636 782660 -606227 -249763 -938261 433328 758096 -758133 -725054 274488 -821016 832304 269196 205397 -645774 308707 -992557 407498 -806189 -879289 899483 -599138 310305 355117 592772 216757 -917684 -241539 511869 -236791 949113 17156 868494 -658701 -573930 -364806 911653 199080 403108 111795 -337037 674243 -411054 215520 -603567 -882817 252440 486827 -654885 384851 -339093 -145234 -846117 -348383 -758886 615185 297141 -198156 -817220 -41088 806815 721524 -372403 743167 -861807 104132 648486 -91160 -499890 -397614 -228540 76334 -73294 212226 -404022 318311 235531 189127 192339 -926570 -224395 810…
Output: 1

Example 3:

Input: 216 -190933 777260 -431572 213949 -197508 626854 -67287 670930 428857 816471 -661336 -962207 -496279 -206017 -718312 774174 -252307 -982244 466638 994597 943488 607849 616603 -501933 -991246 663920 -951202 -516951 52408 35939 -616296 -468126 -376946 441925 194278 -331009 393000 -223037 -993075 -137032 -788356 566437 -830116 -848713 -341739 702257 826773 -894468 -739848 179197 -961852 -348672 -248214 270032 951956 -857743 8843 -736800 -342419 336972 -420212 913741 -349184 223523 -685774 -503445 -419224 485250 455698 674026 49379 943037 69000 -439927 -6034 22447 -941751 -197829 584442 -860862 -846809 258753 -729850 708236 -819985 459493 -239594 -896708 -742815 699156 783864 20467 -56495 -886998 71696 19479 959748 -424017 364667 -395662 -189413 997115 -771759 -669263 256801 672590 53079 36901…
Output: 18

Constraints:

2 <= n <= 887; -1000000 <= a[i] <= 1000000.

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