| Task: | Forest density |
| Sender: | erikpeik |
| Submission time: | 2025-09-22 16:51:21 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | TIME LIMIT EXCEEDED | -- | details |
Code
size, q = input().split()
map_data = []
for _ in range(int(size)):
map_data.append(input())
for _ in range(int(q)):
y1, x1, y2, x2 = [int(i) for i in input().split()]
count = 0
for y in range(y1, y2 + 1):
for x in range(x1, x2 + 1):
# print(f'position: ({y}, {x})')
if map_data[y - 1][x - 1] == "*":
count += 1
# print(f'({y}, {x})')
print(count)
# for row in map_data:
# print(row)
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 10 100 **.*.*.**. *.**.*..*. .*****.**. **....***. ... |
| correct output |
|---|
| 10 14 5 7 8 ... |
| user output |
|---|
| 10 14 5 7 8 ... Truncated |
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 200000 **.**.****..**.***..**.***.**.... |
| correct output |
|---|
| 41079 2824 15631 1548 8483 ... |
| user output |
|---|
| (empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 1000 200000 ******************************... |
| correct output |
|---|
| 1000000 1000000 1000000 1000000 1000000 ... |
| user output |
|---|
| (empty) |
