Submission #73899945


Source Code Expand

import heapq

n, q = map(int, input().split())
a = list(map(int, input().split()))

hq = [(a[i], i+1) for i in range(n)]
heapq.heapify(hq)

for _ in range(q):
    k = int(input())
    b = list(map(int, input().split()))
    
    b_set = set(b)
    popped = []
    
    while hq[0][1] in b_set:
        popped.append(heapq.heappop(hq))
        
    print(hq[0][0])
    
    for p in popped:
        heapq.heappush(hq, p)

Submission Info

Submission Time
Task C - Except and Min
User gett
Language Python (PyPy 3.11-v7.3.20)
Score 300
Code Size 440 Byte
Status AC
Exec Time 668 ms
Memory 163204 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 19
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.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, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_random_3_00.txt, 03_random_3_01.txt, 03_random_3_02.txt, 03_random_3_03.txt, 03_random_3_04.txt, 03_random_3_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 53 ms 82344 KiB
01_random_00.txt AC 539 ms 162796 KiB
01_random_01.txt AC 544 ms 160816 KiB
01_random_02.txt AC 544 ms 154668 KiB
01_random_03.txt AC 547 ms 162620 KiB
01_random_04.txt AC 544 ms 161000 KiB
01_random_05.txt AC 530 ms 160700 KiB
02_random_2_00.txt AC 608 ms 162960 KiB
02_random_2_01.txt AC 604 ms 153900 KiB
02_random_2_02.txt AC 591 ms 161200 KiB
02_random_2_03.txt AC 608 ms 162796 KiB
02_random_2_04.txt AC 600 ms 161128 KiB
02_random_2_05.txt AC 588 ms 160832 KiB
03_random_3_00.txt AC 668 ms 162936 KiB
03_random_3_01.txt AC 659 ms 163060 KiB
03_random_3_02.txt AC 665 ms 163080 KiB
03_random_3_03.txt AC 645 ms 154452 KiB
03_random_3_04.txt AC 664 ms 163204 KiB
03_random_3_05.txt AC 658 ms 163044 KiB