CT62760

Zephyr's Azure Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the frontier camp of Duskwood. Zephyr spreads the ledgers records across the table and picks up a sharp pencil. 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: 3679 -190198931 93687818 -833462301 -888658020 754197569 -55317567 -647169692 977232652 424518854 -355098126 726542797 -79300842 -279648967 -767701351 -996620614 699660173 -762504025 241442214 903281050 216596107 399444381 -520096414 -973486716 -809357371 -25139163 -356383070 24442716 -489420942 622189414 223931448 -690408793 -799949443 954750892 -347193732 -226977232 113989820 146574874 -634858690 176168773 -678253359 -405650080 692470750 -377519495 -590464091 -761976404 375902272 -469401382 311091865 753300874 -880178044 879110515 182652871 350027564 -695246078 -146037013 287190661 -194223815 -184022637 364054646 -503519300 422852102 309585823 878770772 380687418 -331443611 849090817 546175879 462912857 -694523102 -802863863 -334033415 108332847 299206169 119833397 -537461949 523848408 -…
Output: -190198931 -190198931 -190198931 -833462301 -190198931 -190198931 -190198931 -190198931 -55317567 -190198931 -55317567 -79300842 -79300842 -190198931 -190198931 -190198931 -190198931 -190198931 -79300842 -79300842 -55317567 -79300842 -79300842 -190198931 -79300842 -190198931 -79300842 -190198931 -79300842 -79300842 -79300842 -190198931 -79300842 -190198931 -190198931 -190198931 -79300842 -190198931 -79300842 -190198931 -190198931 -190198931 -190198931 -226977232 -226977232 -226977232 -226977232 -226977232 -190198931 -226977232 -190198931 -190198931 -79300842 -190198931 -146037013 -146037013 -146037013 -184022637 -146037013 -184022637 -146037013 -146037013 -79300842 -79300842 -79300842 -79300842 -55317567 -55317567 -55317567 -79300842 -79300842 -79300842 -55317567 -55317567 -55317567 -55317…

Example 2:

Input: 3021 595182778 -856592967 -179476995 -241596856 565890365 -954387342 -394564216 294762337 -31203436 -58672088 -616242208 -680222382 689896246 -106144676 504686348 815539038 794410142 -499439513 139878148 -626496019 -305861056 804931682 -321504189 457493757 558845670 -170823258 -134564474 888398360 -606815103 -453955471 -663368849 -551372653 528880154 168142402 870425840 -23013493 -600357638 -508232680 -152725314 976449020 -822270166 218804880 726200156 739216801 752321419 -609817128 585949477 -880073567 -354293294 -679759352 -643822847 -31086453 -730187862 -567482988 932696715 -137769450 972541509 372618987 -418896261 1792039 701826772 918275121 -119036271 153371010 -458847305 775049825 -137376794 -770983671 -939991158 -842813766 -524088162 7248557 599169886 366185175 93686552 -184954849 3…
Output: 595182778 -856592967 -179476995 -241596856 -179476995 -241596856 -241596856 -241596856 -179476995 -179476995 -179476995 -241596856 -179476995 -179476995 -106144676 -106144676 -58672088 -106144676 -58672088 -106144676 -106144676 -106144676 -106144676 -106144676 -58672088 -106144676 -106144676 -106144676 -106144676 -134564474 -134564474 -170823258 -134564474 -134564474 -106144676 -106144676 -106144676 -134564474 -134564474 -134564474 -134564474 -134564474 -106144676 -106144676 -58672088 -106144676 -58672088 -106144676 -106144676 -134564474 -134564474 -134564474 -134564474 -152725314 -134564474 -137769450 -134564474 -134564474 -134564474 -134564474 -106144676 -106144676 -106144676 -106144676 -106144676 -106144676 -106144676 -119036271 -119036271 -134564474 -134564474 -134564474 -119036271 -11…

Example 3:

Input: 1414 182725541 -915427485 -639494400 201425719 -402382053 82503492 65323511 -790848180 925612602 563800053 -72784305 518506667 -742487616 -742748356 990002464 -92418040 -703300655 -454463873 302762743 -88208164 604014963 22020243 -974101529 444390787 -285352080 -955634535 -849698414 324353044 -233258378 948785675 -676985528 721978272 73530513 -726148684 -554420189 103325140 -310552916 -15610048 537616971 23239639 803133652 92295185 -459567341 743462698 -587242216 -439044516 620701745 -13099507 166670442 101051848 -447997141 -933158917 -945828541 -4042743 -97107902 660872622 -259064484 395333658 -537283013 -369011797 -516692401 745582695 -931408938 642253245 -616675166 -916038174 -969634270 354760494 643238634 438901453 687640309 -767792253 -309618513 -990818255 -898089047 -726056021 592384…
Output: 182725541 -915427485 -639494400 -639494400 -402382053 -402382053 65323511 -402382053 65323511 65323511 65323511 65323511 65323511 -72784305 65323511 -72784305 -72784305 -92418040 -72784305 -88208164 -72784305 -72784305 -72784305 -72784305 -72784305 -88208164 -88208164 -88208164 -88208164 -88208164 -88208164 -88208164 -72784305 -88208164 -88208164 -88208164 -88208164 -88208164 -72784305 -72784305 -15610048 -15610048 -15610048 -15610048 -15610048 -72784305 -15610048 -15610048 -13099507 -13099507 -13099507 -15610048 -15610048 -15610048 -15610048 -15610048 -15610048 -15610048 -15610048 -72784305 -72784305 -72784305 -72784305 -72784305 -72784305 -88208164 -88208164 -88208164 -72784305 -72784305 -15610048 -72784305 -72784305 -88208164 -88208164 -92418040 -88208164 -92418040 -88208164 -92418040 -…

Constraints:

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

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