Wrong Answer
Code
import sys
from heapq import heappush, heappop
def solve():
n = int(input())
a = list(map(int, input().split()))
q = int(input())
heap = []
for i, val in enumerate(a):
heappush(heap, (val, i))
for _ in range(q):
x = int(input())
while heap[0][0] < x:
_, idx = heappop(heap)
print(idx + 1, end=" ")
heappush(heap, (x, idx))
a[idx] = x
break
else:
_, idx = heap[0]
print(idx + 1, end=" ")
heappop(heap)
heappush(heap, (x, idx))
a[idx] = x
print()
if __name__ == "__main__":
solve()
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:52:30
- Judged At
- 2024-10-03 13:29:38
- Judged By
- Score
- 0
- Total Time
- 888ms
- Peak Memory
- 18.117 MiB