| Task: | Dynamic Range Minimum Queries |
| Sender: | kookinnam |
| Submission time: | 2025-09-19 22:06:02 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.04 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
Code
def rangeQuery(n, q, arr, commands):
result = []
for command in commands:
if command[0] == 1:
arr[command[1] - 1] = command[2]
else:
start, end = command[1] - 1, command[2] - 1
min_num = float('inf')
for i in range(start + 1, end + 1):
if arr[i] < min_num:
min_num = arr[i]
result.append(min_num)
# print(min_num)
return result
def main():
# n, q = 8, 4
# arr = [3, 2, 4, 5, 1, 1, 5, 3]
# commands = [[2, 1, 4], [2, 5, 6], [1, 2, 3], [2, 1, 4]]
# result = rangeQuery(n, q, arr, commands)
# print(*result, sep='\n')
n, q = map(int, input().split())
arr = list(map(int, input().split()))
commands = [list(map(int, input().split())) for _ in range(q)]
result = rangeQuery(n, q, arr, commands)
print(*result, sep='\n')
if __name__ == "__main__":
main()Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 8 80 7 6 4 6 2 9 4 8 2 1 1 2 1 2 2 1 3 ... |
| correct output |
|---|
| 7 6 4 4 2 ... |
| user output |
|---|
| inf 6 4 4 2 ... Truncated |
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 200000 398739055 65343131 699208332 3... |
| correct output |
|---|
| 28609 129890 20378 20378 311522 ... |
| user output |
|---|
| (empty) |
