CT25936

Last ledgers of Opal

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Opal found an old ledger of ledgers in the timber yard attic at the mountain city of Highreach. The margin notes pose a precise question. 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 <= 874; 0 <= a[i],x <= 1000000000.

Example 1:

Input: 48 85859294 744186118 451697048 825774966 787588752 30142424 746503792 242837808 948316328 371074108 661689394 133699446 829738398 527330165 934898368 178576435 648505896 730423485 704030148 918851632 128224312 967065451 730807899 963488216 341681532 797644365 404938160 867794442 651628536 796908719 700871472 392393295 213377157 313127925 761244555 805419215 256375680 665779624 145670132 234160697 626086384 211018173 241732900 218203747 698204548 281642183 425451145 480030328
Output: 626086384

Example 2:

Input: 24 640245044 998233939 589456927 753798065 237856276 418914492 969430054 603060816 192382980 308653600 114490937 513767590 929044008 353649529 201090082 658601982 635034148 271563230 36872684 643904912 328894134 131665545 622554965 611511203
Output: 513767590

Example 3:

Input: 488 914458683 819404637 482261088 541634540 72019904 850908730 209599230 960508341 965073621 304623162 510143667 292106653 794724958 126334453 640072622 766385933 383577506 799234300 842517907 540031535 221390599 338660819 53418557 981638627 728037977 275240463 205458513 465517125 652270791 24168552 657138831 860455127 187499413 474128328 722708240 823876441 467876870 13557540 435790364 656942391 634524590 248654656 565520203 53068235 695494387 849569679 840271756 664426979 157042063 615716148 400799744 600944 747640700 305780052 446187259 23238321 820109337 514565315 386514296 4378129 492966351 119828221 862913538 871687938 452414477 937293025 719974931 295880455 709561375 77341148 854896208 573473786 58496335 463143806 653384372 363048732 602403677 855307083 463461326 470349766 940745651…
Output: 487765983

Constraints:

1 <= n <= 874; 0 <= a[i],x <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Last ledgers of Opal - EASY Coding Problem | CodeTikki