CT22777

Sage's Ivory weights

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the thorn maze of Bramblecourt, Sage records each weights in a worn leather ledger. The guild wants answers, not guesses. Task: Print the lower median: the element at position floor((n-1)/2) after sorting (so for even n it is the smaller of the two middles). Input format: First line: n. Second line: n integers. Output format: Print the lower median. Constraints: 1 <= n <= 803; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 669 -328065721 -820786680 -221409257 -641183949 -892902353 -184080544 -543147977 -399693309 -227443133 -94791801 -499090385 -702780638 -526848783 -971572135 -451533593 -956264421 -727830145 -777211119 -235997478 -932128272 -694631811 -240907086 -397319312 -806983392 -418150990 -585049980 -681871858 -274372337 -153414174 -394402965 -175742015 -158957614 -136765797 -873645491 -634184103 -274699779 -723487197 -643399554 -740521236 -682969216 -830841465 -226712105 -310309839 -311002038 -909077296 -689501813 -485754970 -981339275 -758151895 -432681453 -339208183 -633504444 -287295232 -955389048 -920225080 -300441292 -9620952 -268535611 -675608164 -960083274 -798282708 -481019582 -200435366 -923121562 -934634872 -437374259 -393525780 -940401532 -919075374 -985208452 -401531905 -826184942 -848540…
Output: -516579057

Example 2:

Input: 565 -420249748 -550084484 -596948422 -790978241 -784829064 -104516050 -396703355 -429968048 -262351823 -328745207 -319204922 -256680205 -707667789 -72047405 -386140966 -791346027 -512025294 -789509166 -240130436 -157944125 -86032191 -970929168 -630259419 -758646852 -776357343 -259076187 -775844262 -256408453 -455061887 -222509001 -239331985 -658550231 -639834145 -671218371 -604886160 -104878831 -754186831 -140838825 -965347616 -937257740 -266009178 -846020721 -531025161 -831568554 -832551335 -729498266 -207379534 -34048661 -899664212 -720730295 -682513399 -538356143 -180622307 -678812001 -587634891 -411404360 -218750868 -299859377 -480283100 -53232465 -491663543 -821551438 -817949567 -488738127 -726116905 -130344838 -821696711 -431457211 -324380399 -22752300 -67530174 -694223571 -470237143…
Output: -469988281

Example 3:

Input: 712 -486126146 -264615916 -536887481 -694123877 -828199890 -851795990 -466275132 -86802623 -360564665 -987815758 -458924733 -658633439 -531578975 -131956740 -36886790 -816186676 -509249478 -432637158 -644976131 -565878585 -634278538 -1016535 -165724515 -17201598 -339422037 -307294734 -715421067 -631435312 -572795430 -994164172 -198066718 -868605309 -676470099 -452976131 -782574270 -432215406 -886687591 -848495343 -929901697 -631993379 -566921456 -895718092 -495147302 -291004389 -217023843 -510407778 -367649889 -711703982 -242963468 -669726185 -403229188 -209408613 -981721993 -744315041 -300080624 -452049391 -242931619 -315431274 -883532326 -377146511 -657838744 -75795712 -570525406 -338921964 -830651565 -873932724 -200182769 -510850912 -426199080 -67654455 -900301660 -362312001 -982565177 …
Output: -497003492

Constraints:

1 <= n <= 803; -1000000000 <= a[i],x <= 1000000.

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