CT57329

The Middle So Far of Glowtide

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the lantern reef of Glowtide pays by the answer, and Archivist intends to earn it. First: the full register of registers. Task: After each arrival, print the median of the stream so far — defined as the element at sorted position ceil(k/2) (1-based). Input format: First line: n. Second line: n integers. Output format: Print n medians space-separated. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 3182 15545602 -407715541 -919332762 806981513 285359125 -20654708 -84965743 545275636 395725493 411946604 -999005991 814443073 -874237386 -142182708 -699589857 -568720604 671059294 898576098 -920802347 -559454147 959715920 -747642021 -647467267 377158209 482177768 137087589 755417660 183050959 -386430422 -713077335 719587512 249485859 420959471 876725577 542665827 868751249 -487059495 -603103863 -397154743 -627569887 853912458 26375208 -970289423 687803059 -277001853 418055389 -674440590 -247107745 -476518897 -262254194 -830549992 -628469396 -558108721 543633235 700413539 8624394 127051721 18919978 -732224902 -896305530 435485582 488886576 946047895 355121575 -747420184 -923475382 -42524829 832437474 -453998574 77399006 895298341 -707174285 158728811 419969226 215949714 594191996 831643282…
Output: 15545602 -407715541 -407715541 -407715541 15545602 -20654708 -20654708 -20654708 15545602 15545602 15545602 15545602 15545602 -20654708 -20654708 -84965743 -20654708 -20654708 -20654708 -84965743 -20654708 -84965743 -84965743 -84965743 -20654708 -20654708 15545602 15545602 15545602 -20654708 15545602 15545602 137087589 137087589 183050959 183050959 183050959 137087589 137087589 15545602 137087589 26375208 26375208 26375208 26375208 26375208 26375208 15545602 15545602 -20654708 -20654708 -84965743 -84965743 -84965743 -20654708 -20654708 8624394 8624394 8624394 -20654708 8624394 8624394 15545602 15545602 15545602 8624394 8624394 8624394 8624394 8624394 15545602 8624394 15545602 15545602 18919978 18919978 26375208 18919978 18919978 15545602 18919978 18919978 18919978 18919978 18919978 1554560…

Example 2:

Input: 1949 20337963 -203426716 91460879 101219601 568064143 384150803 9941333 -753291087 763134812 368870264 -492806983 -31742609 632986001 -113592131 707809409 -585846586 -424053806 -186023473 761611666 -307865534 -312353000 831731798 924331158 -282738390 286969663 -758992710 -509984663 -551579104 -358768752 350775770 812565698 -728335839 -201671915 -544926663 299271864 109037804 -256418137 782965592 763203627 656742849 798399570 247249989 -791726525 590892789 30837601 468113824 -252617753 51607765 -898017907 -917028631 -68649853 982062868 -670491494 423157519 -915414914 -62785489 -765312003 -759855518 931195146 -869160088 -362671641 -683434370 809154705 -949279209 -982577241 -574875691 -436744958 541369764 984365687 -278187790 -60111105 617425983 142503786 46591742 103455645 143117987 -3386239…
Output: 20337963 -203426716 20337963 20337963 91460879 91460879 91460879 20337963 91460879 91460879 91460879 20337963 91460879 20337963 91460879 20337963 20337963 9941333 20337963 9941333 9941333 9941333 20337963 9941333 20337963 9941333 9941333 -31742609 -31742609 -31742609 9941333 -31742609 -31742609 -113592131 -31742609 -31742609 -31742609 -31742609 9941333 9941333 20337963 20337963 20337963 20337963 30837601 30837601 30837601 30837601 30837601 20337963 20337963 20337963 20337963 20337963 20337963 9941333 9941333 -31742609 9941333 -31742609 -31742609 -62785489 -31742609 -62785489 -62785489 -68649853 -68649853 -68649853 -62785489 -68649853 -62785489 -62785489 -60111105 -60111105 -31742609 -31742609 -31742609 -31742609 -31742609 -31742609 9941333 -31742609 9941333 -31742609 -31742609 -41691111 -3…

Example 3:

Input: 3751 66731159 -743688652 -538654836 -508340558 -783227132 573819751 383918089 406442267 -145567588 -810590393 -915221696 467887841 113489125 744557731 973248573 294113099 358412329 -733645690 431264392 -658140268 -957520360 -662857397 -806702952 381126344 106837971 37602953 201971158 601287946 -636032282 91955240 -740370215 759215309 488716808 -716577584 748489057 303727565 878807886 -554778708 -57969221 141045583 4587959 696863524 -650475893 -689527199 -320530844 222205651 612798859 -58904528 657944002 788940069 407286124 225413376 -158244280 913837083 -302497672 539721981 370973413 273853736 171142393 510744492 -687902971 939620963 426155437 551648780 -221131072 934292816 -272944866 943432648 -223121545 453907242 786627934 651297209 434591067 873326139 -196267641 -64948717 784033200 -312…
Output: 66731159 -743688652 -538654836 -538654836 -538654836 -538654836 -508340558 -508340558 -145567588 -508340558 -508340558 -508340558 -145567588 -145567588 66731159 66731159 113489125 66731159 113489125 66731159 66731159 -145567588 -145567588 -145567588 66731159 37602953 66731159 66731159 66731159 66731159 66731159 66731159 91955240 66731159 91955240 91955240 106837971 91955240 91955240 91955240 91955240 91955240 91955240 66731159 66731159 66731159 91955240 66731159 91955240 91955240 106837971 106837971 106837971 106837971 106837971 106837971 113489125 113489125 141045583 141045583 141045583 141045583 171142393 171142393 171142393 171142393 171142393 171142393 171142393 171142393 201971158 201971158 222205651 222205651 222205651 201971158 222205651 201971158 222205651 201971158 222205651 20197…

Constraints:

1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

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