Submission #75878890


Source Code Expand

import heapq

x = int(input())
q = int(input())
a = []
b = []

for _ in range(q):
    aq, bq = map(int, input().split())
    a.append(aq)
    b.append(bq)

low = [-x]
high = []

for i in range(q):
    for v in (a[i], b[i]):
        heapq.heappush(high, -heapq.heappushpop(low, -v))
        if len(low) < len(high):
            heapq.heappush(low, -heapq.heappop(high))
            
    print(-low[0])

Submission Info

Submission Time
Task D - Chalkboard Median
User gett
Language Python (PyPy 3.11-v7.3.20)
Score 400
Code Size 421 Byte
Status AC
Exec Time 530 ms
Memory 150504 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 25
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 47 ms 81852 KiB
00_sample_01.txt AC 47 ms 81912 KiB
00_sample_02.txt AC 47 ms 82024 KiB
01_random_00.txt AC 380 ms 147576 KiB
01_random_01.txt AC 380 ms 146540 KiB
01_random_02.txt AC 403 ms 146508 KiB
01_random_03.txt AC 389 ms 144828 KiB
01_random_04.txt AC 477 ms 148812 KiB
01_random_05.txt AC 351 ms 142372 KiB
01_random_06.txt AC 349 ms 132488 KiB
01_random_07.txt AC 475 ms 148992 KiB
01_random_08.txt AC 305 ms 126616 KiB
01_random_09.txt AC 465 ms 149632 KiB
01_random_10.txt AC 262 ms 121524 KiB
01_random_11.txt AC 473 ms 149292 KiB
01_random_12.txt AC 530 ms 150108 KiB
01_random_13.txt AC 512 ms 150504 KiB
01_random_14.txt AC 429 ms 147084 KiB
01_random_15.txt AC 432 ms 146452 KiB
01_random_16.txt AC 464 ms 149504 KiB
01_random_17.txt AC 473 ms 148512 KiB
01_random_18.txt AC 482 ms 148992 KiB
01_random_19.txt AC 474 ms 148228 KiB
01_random_20.txt AC 471 ms 149272 KiB
01_random_21.txt AC 470 ms 149116 KiB