Code
import heapq
def find_min_index(arr):
return arr.index(min(arr))
def solve(n, arr, q):
min_heap = list(enumerate(arr))
heapq.heapify(min_heap)
for _ in range(q):
index, min_val = heapq.heappop(min_heap)
print(index + 1) # Print 1-based index
x = int(input())
arr[index] = x
heapq.heappush(min_heap, (index, x))
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:51:06
- Judged At
- 2024-08-16 15:51:06
- Judged By
- Score
- 0
- Total Time
- 36ms
- Peak Memory
- 2.781 MiB