| Task: | Monikulmio |
| Sender: | Wiita |
| Submission time: | 2025-11-03 12:03:34 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | 69 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 69 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | 10 | details |
| #2 | ACCEPTED | 0.06 s | 10 | details |
| #3 | ACCEPTED | 0.06 s | 7 | details |
| #4 | ACCEPTED | 0.06 s | 7 | details |
| #5 | ACCEPTED | 0.07 s | 7 | details |
| #6 | ACCEPTED | 0.05 s | 7 | details |
| #7 | ACCEPTED | 0.12 s | 7 | details |
| #8 | ACCEPTED | 0.11 s | 7 | details |
| #9 | RUNTIME ERROR | 0.14 s | 0 | details |
| #10 | ACCEPTED | 0.23 s | 7 | details |
Code
n, m, k = map(int, input().split())
ruudukko = {}
# Alusta ruudukko
for y in range(int(n)):
for x in range(int(m)):
ruudukko[f"{y},{x}"] = "#"
pisteet = []
for i in range(int(k)):
y, x = input().split()
pisteet.append([int(y) - 1,int(x) - 1])
# nuudeli koodi joka tekee janat
for piste in range(len(pisteet)):
piste1 = pisteet[piste]
piste2 = pisteet[(piste + 1) % k]
y,x = piste1[0], piste1[1]
while True:
dy = (piste1[0] < piste2[0]) - (piste1[0] > piste2[0])
dx = (piste1[1] < piste2[1]) - (piste1[1] > piste2[1])
merkki = "."
if y == piste2[0] and x == piste2[1] or y == piste1[0] and x == piste1[1]:
merkki = "*"
elif dy == 0:
merkki = "="
elif dx == 0:
merkki = "|"
elif dy == dx:
merkki = "\\"
else:
merkki = "/"
ruudukko[f"{y},{x}"] = merkki
if y == piste2[0] and x == piste2[1]:
break
y += dy
x += dx
def floodfill(ruudukko, x, y):
if ruudukko[f"{y},{x}"] == "#":
ruudukko[f"{y},{x}"] = "."
if x > 0:
floodfill(ruudukko,x-1,y)
if x < m - 1:
floodfill(ruudukko,x+1,y)
if y > 0:
floodfill(ruudukko,x,y-1)
if y < n - 1:
floodfill(ruudukko,x,y+1)
for y in range(n):
hit = False
for x in range(m):
if ruudukko[f"{y},{x}"] == "*" or ruudukko[f"{y},{x}"] == "|" or ruudukko[f"{y},{x}"] == "/" or ruudukko[f"{y},{x}"] == "\\":
hit = not hit
if ruudukko[f"{y},{x}"] == "#" and hit == False:
floodfill(ruudukko, x, y)
# Tulosta ruudukko
for y in range(n):
for x in range(m):
print(ruudukko[f"{y},{x}"], end="")
print("")Test details
Test 1 (public)
Verdict: ACCEPTED
| input |
|---|
| 8 9 5 5 2 2 5 5 8 7 8 ... |
| correct output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
| user output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
Test 2 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 4 5 10 5 30 15 30 15 10 |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Test 3 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 29 8 7 13 2 14 2 9 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 30: expected '#', got '.'
Test 4 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 14 5 12 5 25 8 28 13 28 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 10: expected '#', got '.'
Test 5 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 12 3 20 7 16 7 9 11 13 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 20: expected '#', got '.'
Test 6 (public)
Verdict: ACCEPTED
| input |
|---|
| 9 35 33 2 3 2 8 4 8 4 5 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 3: expected '#', got '.'
Test 7 (public)
Verdict: ACCEPTED
| input |
|---|
| 30 100 69 6 10 6 14 7 14 7 18 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 10: expected '#', got '.'
Test 8 (public)
Verdict: ACCEPTED
| input |
|---|
| 40 60 192 11 3 11 5 10 6 11 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| ................................. |
Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 30: expected '#', got '.'
Test 9 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| 50 100 142 1 1 1 7 1 11 1 14 ... |
| correct output |
|---|
| *=====*===*==*................... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 66, in <module>
floodfill(ruudukko, x, y)
File "input/code.py", line 54, in floodfill
floodfill(ruudukko,x+1,y)
File "input/code.py", line 54, in floodfill
floodfill(ruudukko,x+1,y)
File "input/code.py", line 54, in floodfill
floodfill(ruudukko,x+1,y)
[Previous line repeated 82 more times]
File "input/code.py", line 58, in floodfill
floodfill(ruudukko,x,y+1)
File "input/code.py", line 52, in floodfill
floodfill(ruudukko,x-1,y)
File "input/code.py", line 52, in floodfill
floodfill(ruudukko,x-1,y)
File "input/code.py", line 52, in floodfill
floodfill(ruudukko,x-1,y)
[Previous line repeated 23 more times]
File "input/code.py", line 58, in floodfill
floodfill(ruudukko,x,y+1)
File "input/code.py", line 54, in floodfill
floodfill(ruudukko,x+1,y)
File "input/code.py", line 54, in floodfill
floodfill(ruudukko,x+1,y)
File "input/code.py", line 54, in floodfill...Test 10 (public)
Verdict: ACCEPTED
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
| ...*====*........................ |
Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 86: expected '#', got '.'
