CT21868

The Closest Pair Beneath Winterholt

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the snowberry thicket of Winterholt opens only for a perfect tally of weights. Lothar means to find out. 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 <= 515; -1000000000 <= a[i] <= 1000000.

Example 1:

Input: 443 -768395256 -405591556 -334946637 -231963719 -772507183 -400754427 -938657988 -902230246 -289254480 -209215898 -109000545 -725537111 -915540562 -298281177 -4438545 -53457493 -284523208 -692333848 -766589056 -297880385 -854979590 -714815108 -53178230 -535240638 -338103600 -217774632 -547343231 -102013571 -538642888 -866129737 -426107008 -120859078 -604004936 -942269890 -995469638 -925639195 -424002615 -896875325 -395745319 -881047425 -633473575 -468067497 -310226994 -310585995 -508328739 -272019676 -801069476 -342927983 -381991849 -144909752 -153475723 -272984228 -666112059 -649100457 -550224892 -970645253 -910680423 -12287437 -766873495 -364031171 -296362919 -110397485 -976313157 -795512108 -588781453 -596698603 -938222071 -434480215 -668726057 -588748130 -85957810 -799781171 -945680269…
Output: 1790

Example 2:

Input: 331 -668887940 -844858328 -486813796 -41214608 -305846449 -186216532 -182720429 -744364070 -239135388 -963154270 -464130896 -898732418 -657190106 -760329418 -567851774 -919320629 -854319283 -176765832 -706878880 -285324929 -826784327 -39012552 -652845345 -395257610 -500014051 -188482814 -127474472 -7564023 -690600884 -395901129 -932670028 -625757024 -336200296 -178601106 -711587644 -108627639 -879454039 -267847829 -783975878 -753568749 -994904906 -644742572 -386848427 -729443337 -600940602 -651659964 -202036483 -567515312 -545986896 -453893928 -765473479 -257093852 -472239273 -669696818 -842027002 -316328117 -577098949 -116147187 -981036961 -775965930 -175913037 -715905857 -295772902 -726477134 -65006914 -26275196 -768442759 -939616513 -958762593 -929928378 -453991191 -645271403 -394330764…
Output: 21702

Example 3:

Input: 106 -641931289 -696078995 -862587177 -325586184 -611311431 -277942954 -498391424 -236544267 -508137365 -508324419 -606289846 -670426957 -300051421 -708248028 -944909376 -468344440 -833158804 -204323042 -733459219 -95655924 -472157956 -859631599 -578969929 -395008827 -685167749 -166935745 -832107440 -372319740 -298907951 -857957090 -178636565 -381213509 -55003835 -995480168 -33182387 -937640084 -390091126 -125887386 -666866925 -633873489 -16552291 -411503728 -276086820 -957174592 -160706057 -825926661 -790554554 -114612043 -444015238 -987511433 -356526895 -731398148 -137807912 -282733821 -15646115 -638532997 -770565756 -933824375 -384279091 -647430020 -892730332 -205325683 -655532598 -41510173 -185009523 -739569657 -866432136 -772200012 -250362102 -749283623 -173936601 -351153337 -185152071…
Output: 142548

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Closest Pair Beneath Winterholt - EASY Coding Problem | CodeTikki