/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.344 MiB
#2 Accepted 509ms 3.234 MiB
#3 Accepted 539ms 3.57 MiB
#4 Accepted 545ms 3.727 MiB
#5 Accepted 642ms 21.137 MiB
#6 Accepted 668ms 21.023 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-10-03 13:29:34
Judged By
Score
100
Total Time
668ms
Peak Memory
21.137 MiB