/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 18ms 2.77 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)  # Print 1-based index
        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
Pretest
Problem
P1086 KuZ the Position
Language
Python 3 (Python 3.12.3)
Submit At
2024-08-16 15:53:17
Judged At
2024-08-16 15:53:17
Judged By
Score
10
Total Time
18ms
Peak Memory
2.77 MiB