CT63034

Fiora's signals Reckoning

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the galleon yard of Masthead; Fiora weighs the day's signals manifests and starts the calculations. 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: 466 -1487928 -824877799 979163022 -268976470 -475828305 -492549311 -674669872 -371570792 -230333424 253207370 -35470089 -38180149 -271318164 -10037241 -716524551 -202583793 -821064143 -177229819 -71050063 -73394118 -947445225 160980596 -359070341 -298831480 -488193204 389809670 762396287 661514534 -140257692 -608526330 -447136945 -291892889 891354323 673623020 173195437 -947801919 -678059912 410928684 -400685691 309503655 -902610639 308156559 -318464331 564922846 -242903540 593771713 -217082017 943448230 904818451 -957545355 -945104070 -167204857 -100310836 -391251675 -182743775 416310656 -58204415 -819115765 -212279334 97108336 771579606 -972000073 -842378851 -273528055 565612631 -764965693 -896342774 248826217 41993812 791899825 -585716427 821842745 207044690 195532547 -15191686 -3262104…
Output: -1487928 -824877799 -1487928 -268976470 -268976470 -475828305 -475828305 -475828305 -371570792 -371570792 -268976470 -268976470 -268976470 -268976470 -268976470 -268976470 -268976470 -268976470 -230333424 -230333424 -230333424 -230333424 -230333424 -268976470 -268976470 -268976470 -230333424 -230333424 -202583793 -230333424 -230333424 -268976470 -230333424 -230333424 -202583793 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -230333424 -217082017 -217082017 -202583793 -217082017 -217082017 -217082017 -202583793 -217082017 -202583793 -202583793 -182743775 -202583793 -202583793 -202583793 -182743775 -202583793 -202583793 -212279334 -202583793 -212279334 -212279334 -212279334 -202583793 -202583793 -202583793 -202583793 -182743775 -…

Example 2:

Input: 3579 237249712 -242849845 921285243 -603179247 638924023 -532182520 -72708660 588085943 -300033043 832033498 -235232917 -72097015 787953407 985647955 31747436 -167069505 -97612963 641824416 -805375086 -121580066 -879891398 -363563832 881824981 -321897828 163632856 -365128701 32563543 941029240 473411832 961192480 -997929100 876057525 -303543904 -423638991 17908041 -294192962 -790498597 -758610680 953387411 311314491 -11029324 -685583091 523765217 -272506329 -2269601 330361490 -622986514 77761507 138272650 -793942728 916805714 -796952256 -888613741 -499233308 -927516321 765587578 662930344 -352511987 -685248922 -330038488 416107449 362520667 504810381 -768683647 542777548 -442331569 901953343 226722723 -379838291 349318712 681760453 -41948374 -708788709 974019638 732646475 -836849730 979772…
Output: 237249712 -242849845 237249712 -242849845 237249712 -242849845 -72708660 -72708660 -72708660 -72708660 -72708660 -72708660 -72097015 -72097015 31747436 -72097015 -72097015 -72097015 -72097015 -72708660 -72708660 -97612963 -72708660 -97612963 -72708660 -97612963 -72708660 -72708660 -72097015 -72097015 -72097015 -72097015 -72097015 -72708660 -72097015 -72708660 -72708660 -97612963 -72708660 -72708660 -72097015 -72708660 -72097015 -72708660 -72097015 -72097015 -72097015 -72097015 -11029324 -72097015 -11029324 -72097015 -72097015 -72708660 -72708660 -72708660 -72097015 -72708660 -72708660 -97612963 -72708660 -72708660 -72097015 -72708660 -72097015 -72708660 -72097015 -72097015 -72097015 -72097015 -11029324 -41948374 -41948374 -41948374 -11029324 -41948374 -11029324 -41948374 -41948374 -7209701…

Example 3:

Input: 185 58898166 426011570 179679040 889658786 879255489 -680213592 -852581571 -674515062 52733616 -536154910 469080086 526873488 448687061 632058012 446292956 -79762128 537815241 -110032728 -515256245 912132166 -54923754 -790823229 711514272 299919320 -512584609 444552569 -271078389 625969332 -974963358 -64787197 -402049747 442305817 -599409213 -249120159 -506258261 646482930 416793528 564418423 -419550380 -10432519 659747926 -13448220 -960933242 7368929 -565295684 925777198 -898230756 219271703 928252036 -58240335 596231171 772294227 391274032 -300187255 -725493180 829694181 454081841 373487027 -432377458 -410386626 -406596521 871506826 -58936209 -304880822 488500839 11874606 989483315 -664824026 591014230 -196610944 495517155 -561742101 -224724242 -79690778 -544066417 -524374817 402875407 2…
Output: 58898166 58898166 179679040 179679040 426011570 179679040 179679040 58898166 58898166 52733616 58898166 58898166 179679040 179679040 426011570 179679040 426011570 179679040 179679040 179679040 179679040 58898166 179679040 179679040 179679040 179679040 179679040 179679040 179679040 58898166 58898166 58898166 58898166 52733616 52733616 52733616 58898166 58898166 58898166 52733616 58898166 52733616 52733616 7368929 7368929 7368929 7368929 7368929 52733616 7368929 52733616 52733616 58898166 52733616 52733616 52733616 58898166 58898166 58898166 52733616 52733616 52733616 52733616 7368929 52733616 11874606 52733616 11874606 52733616 11874606 52733616 11874606 11874606 7368929 7368929 -10432519 7368929 7368929 11874606 7368929 7368929 7368929 11874606 11874606 11874606 7368929 7368929 7368929 736…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Fiora's signals Reckoning - MEDIUM Coding Problem | CodeTikki