/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 2.918 MiB
#2 Accepted 322ms 3.184 MiB
#3 Accepted 546ms 3.422 MiB
#4 Accepted 509ms 3.527 MiB
#5 Accepted 463ms 20.824 MiB
#6 Accepted 541ms 20.863 MiB

Code

import heapq

def solve(n, arr, q):
    min_heap = [(val, idx) for idx, val in enumerate(arr)]
    heapq.heapify(min_heap)

    for _ in range(q):
        min_val, min_idx = heapq.heappop(min_heap)
        print(min_idx + 1)  
        x = int(input())
        heapq.heappush(min_heap, (x, min_idx))

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

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
Python 3 (Python 3.12.3)
Submit At
2024-08-16 15:53:33
Judged At
2024-08-16 15:53:33
Judged By
Score
100
Total Time
546ms
Peak Memory
20.863 MiB