| Task: | Dynamic Range Minimum Queries |
| Sender: | aalto26dh_024 |
| Submission time: | 2026-09-23 15:55:53 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.06 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
Code
from math import sqrt
buffer = input().split()
n = int(buffer[0])
q = int(buffer[1])
values = list(map(int,input().split()))
m = int(sqrt(n))
roots = []
def update(k,u):
values[k] = u
ri = k//m
roots[ri] = min(roots[ri], u)
for i in range(m):
roots.append(min(values[i*m:(i+1)*m]))
roots.append(min(values[m**2:]))
for i in range(q):
query = input().split()
qtype = int(query[0])
a = int(query[1])
b = int(query[2])
if qtype == 1:
a -= 1 #zero-based indexing
update(a,b)
elif qtype == 2:
a -= 1 #zero-based indexing
b -= 1 #zero-based indexing
print(min(values[a:b+1]))Test details
Test 1
Verdict: RUNTIME ERROR
| 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 |
|---|
| 7 6 4 4 2 ... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 28, in <module>
update(a,b)
File "/box/input/code.py", line 15, in update
roots[ri] = min(roots[ri], u)
IndexError: list index out of rangeTest 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 200000 398739055 65343131 699208332 3... |
| correct output |
|---|
| 28609 129890 20378 20378 311522 ... |
| user output |
|---|
| (empty) |
