/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 16ms 3.141 MiB
#2 Accepted 516ms 3.328 MiB
#3 Accepted 555ms 3.695 MiB
#4 Accepted 587ms 3.711 MiB
#5 Accepted 690ms 21.168 MiB
#6 Accepted 682ms 21.062 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-11-11 03:17:00
Judged By
Score
100
Total Time
690ms
Peak Memory
21.168 MiB