CT23603

The Sunspire Middle Mark

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Smith inherited the shed at the temple city of Sunspire along with its curious bookkeeping system for weights. Time to make sense of it. 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 <= 675; -1000000 <= a[i],x <= 1000000.

Example 1:

Input: 295 -182756 -147858 990554 516662 -635133 -661219 155879 775067 -77686 -363166 -606602 -688682 -919797 729210 -222862 -308055 -432602 734658 -777942 798241 744546 29448 -106681 -432299 810527 -289394 -640799 -422405 35894 -881947 -263234 -274883 893837 327392 -638370 774361 -935358 510931 912159 431133 -41918 269543 -21465 -2400 707036 -101412 455201 -973515 314696 854646 -512143 125297 -192848 341142 555947 476456 184597 618218 664094 706491 -81371 622925 402281 741018 831034 400459 -169234 717010 -394183 356465 109614 -673174 5271 799646 359508 -783222 -762842 -664557 -803779 265908 -953718 -620571 -59412 -595660 -101000 -925206 564531 854142 -84510 -428843 976007 -760031 -579451 240655 458047 -978369 637931 743680 -548161 758462 -909102 238487 -930024 847254 -658400 652536 300902 810384…
Output: -48002

Example 2:

Input: 84 -644390 -21041 6725 -437323 867327 706772 -491787 -770087 -595082 -431375 621055 524268 684207 -688053 252831 -988615 638721 -196680 205971 398256 -354841 269215 -926433 406498 -56554 -321818 -676908 -915605 216866 665604 -308841 847185 782540 -918808 22427 -732551 380065 -236597 -767406 229758 -251572 -149468 -52786 255549 119135 66173 -507759 907195 28183 -97805 344895 -216871 504365 -896051 -675848 659434 -38846 840232 87307 142669 997875 -836456 189396 664388 453366 871840 -562424 -664836 -47982 -636298 -187840 -12351 -810454 -437534 617277 924724 201311 954752 705599 912794 -156083 847305 921040 165789
Output: 22427

Example 3:

Input: 10 967762 411967 -256631 -75269 -743277 656581 -762254 -484201 -979657 -135565
Output: -256631

Constraints:

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

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