CT25600

The Middle Mark at Leatherwick

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the tannery row of Leatherwick; Nico weighs the day's shelves manifests and starts the calculations. 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 <= 352; -1000000000 <= a[i],x <= 1000000000.

Example 1:

Input: 56 -951591974 897984777 526257280 -93880963 800016090 -152624628 -599485555 -550622900 483006211 -67349401 -80857114 804636136 -594215809 -866576729 125001077 -583465820 509063908 -506007254 -848040469 -211322814 -785606836 379583510 356798116 911533008 142630597 332929911 -533069443 -553690731 -371170915 -175047103 104231459 781937120 266959154 -424381199 829955004 941664133 -715696820 174997130 149840070 682566142 -575811741 353501688 127787961 774658019 -4497033 388354898 -524576493 -767386073 -864320596 914859959 602028749 650722183 -70858332 548929971 588212068 -353950992
Output: 104231459

Example 2:

Input: 258 -859230835 775198322 729905510 -358683507 400848910 658726862 -620489105 -829546784 -622111453 -532983364 -188303214 463661118 414567789 797389147 378897362 -782234047 -5604659 -357328561 -903872749 150434326 -769846987 -999320406 412605129 -193693753 48396999 -638361998 778275469 321719916 5177969 -685677309 -261401926 -737952213 337117380 227271402 -324016306 -572295193 -106192557 931050837 -575689380 101770831 95789509 -114096746 -686837432 217952154 -738533097 281399148 288106211 -308236485 403971335 -687286487 -708877625 -528912056 591136745 981936729 -856159355 -711740844 939233987 -520105089 -472901174 902320126 175537784 947260607 -249015011 145370445 -740343404 70748934 28366574 954327071 158175419 298814063 -25903844 793833521 -116215055 -327224131 -525751432 675967948 -55733474 802219617 -667861353 -708572497 -231303071 723642446 -485167077 810063339 472319979 630726818 -35252650 913739781 540672373 -485744525 -782770484 466309631 -824365001 338925739 -180845082 872767905 -706588828 -140432974 -184530130 -963231484 8470157 663756091 661342267 416652863 624357871 412537712 79541288 616825011 -778190844 -915105613 -301826829 -376080660 -886624031 -721947112 -610702064 -978981073 855842161 732556036 -598906668 143114210 713419573 -539011236 386593583 -300270573 -835661416 643377826 -81322102 183067682 41710663 -852498777 -126004259 553714102 -198673907 -710413418 -753348370 -606622532 43650054 -268202646 665546979 -698116156 922959880 -712468445 -996251271 -432951535 426036699 363654387 691675779 200809494 611129282 -965222826 577124397 -917454441 -188574529 324227461 903872987 -282772650 969813751 -722174164 871047931 -901579988 870893396 -606410185 740871757 -338895844 -674142812 -127295836 810571034 -926792556 468736090 84424641 -99957358 979741358 -272988223 -83130238 520011303 355041403 645046748 -229529605 127151159 498278060 -750714905 613331735 -776532581 -232833559 -63948685 230752609 30399912 663453230 -213825870 -835930064 -898883519 -28921810 546762469 14936054 687190336 -764546 573344147 554460662 283842391 -427868164 474697796 -455660420 -374621561 -530394314 -861000554 441278972 -99475390 -491233198 751986809 968280552 327802876 -525261513 940563526 836918988 -52889230 124513448 794379587 608009765 -407900861 -665144986 115832809 -957246684 785056724 433012099 -718347719 303145117 -647143051 -532034217 -689861339 618894839 -415153200 17070431 -538158282 753234891 582428729 -121303909 20581764 670141520 -1778101 947454997 -209496445 418291954 -904087301 -642235072 732138293 -865145814 -521428098 -390571594 353582200 747682389 898142046 -337529658 -915428617 -90084880 469126592 354633529 601031531 177694002
Output: -1778101

Example 3:

Input: 233 38116853 -366211461 544637351 -123547628 -779281406 470835975 474595690 -898129685 280773033 346309809 -832799677 950453768 -427317326 -304996617 -363681575 -200103333 245945993 -19569578 -371308417 -976682080 -305240408 748220050 742138921 227322271 476664603 -189772271 -154669285 -528560728 -67948210 -957528041 694226829 -397990036 433911163 -485120384 -507704347 -463894682 819234430 -137514969 -194423907 -882705829 858392939 392894114 -184891746 923297128 -283479972 493754091 -579443239 537242916 380140304 117613991 -815023987 759569538 472058513 -681101862 -513594001 514468626 352358649 863213543 365687110 158613044 -586115724 -65329083 293119159 640327374 -619301243 92079092 975320411 -799472102 -542314965 -873573979 96477278 925276219 196089587 -198760228 477218385 16907746 -190667523 -425184407 405657124 485515031 39322536 741651633 966268089 -671921645 607105987 -940028610 -947985908 794528449 188408770 433065432 144368891 -523945891 -11028872 343397599 582968736 -284076469 356956894 970213972 -215215717 723734534 210571813 428458696 -102882763 140321250 643191447 326858582 33048418 -734023289 624498180 826299557 -615374772 99502199 212024953 784392628 -315323664 -40834577 56187010 -932242508 363992433 -636315099 864365292 780299888 -818221448 -693247141 375291116 143596806 -308810107 -442303552 -962782581 -934283817 671727656 -11506411 136157962 -978474717 -867755890 309169009 -2666230 51499853 -732981597 984804810 504241478 -791665012 -59511089 -974204313 549545002 -74113754 -182035271 -55610318 -414404626 814277843 948799538 395621037 -112284662 -530082895 -573145018 -71514909 -648329527 -70541758 -641166122 -990705693 -59247646 328703500 666782205 445036598 551172555 862274425 -382977778 949579921 255348685 791735375 -893282335 224493002 -588184141 141516592 -512730269 -180255693 533242668 437677766 966117822 -810984303 454251125 741104711 -83647297 821904757 555586023 441056321 743267906 24427027 852541641 223696576 -66829962 -355756490 884041399 -462395984 -556033695 -453106618 -784364267 123952018 99013173 756627518 372923625 783845387 481842067 688442259 180206812 -426820066 -305966306 763432836 994238430 -286048811 737167969 653710218 27799565 246821424 303098741 -323697054 832984951 316791919 422610080 -723798740 91632910 667676536 -916960245 -433047118 -84315887 390527221 876374483 -31841889 -759594210 -22621398 975520920 246453289 -638214848
Output: 96477278

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Middle Mark at Leatherwick - EASY Coding Problem | CodeTikki