Submission details
Task:Monikulmio
Sender:Wiita
Submission time:2025-11-03 12:03:19 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.04 s0details
#20.06 s0details
#30.06 s0details
#40.06 s0details
#50.06 s0details
#60.05 s0details
#70.12 s0details
#80.11 s0details
#90.14 s0details
#100.25 s0details

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
            print(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:

input
8 9 5
5 2
2 5
5 8
7 8
...

correct output
.........
....*....
.../#\...
../###\..
.*#####*.
...

user output
True
True
False
True
False
...

Feedback: Incorrect length on line 1: expected 9, got 4

Test 2 (public)

Verdict:

input
20 40 4
5 10
5 30
15 30
15 10

correct output
.................................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 40, got 4

Test 3 (public)

Verdict:

input
20 40 29
8 7
13 2
14 2
9 7
...

correct output
.................................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 40, got 4

Test 4 (public)

Verdict:

input
20 40 14
5 12
5 25
8 28
13 28
...

correct output
.................................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 40, got 4

Test 5 (public)

Verdict:

input
20 40 12
3 20
7 16
7 9
11 13
...

correct output
.................................

user output
True
True
False
True
False
...

Feedback: Incorrect length on line 1: expected 40, got 4

Test 6 (public)

Verdict:

input
9 35 33
2 3
2 8
4 8
4 5
...

correct output
.................................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 35, got 4

Test 7 (public)

Verdict:

input
30 100 69
6 10
6 14
7 14
7 18
...

correct output
.................................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 100, got 4

Test 8 (public)

Verdict:

input
40 60 192
11 3
11 5
10 6
11 7
...

correct output
.................................

user output
True
True
False
True
False
...

Feedback: Incorrect length on line 1: expected 60, got 4

Test 9 (public)

Verdict:

input
50 100 142
1 1
1 7
1 11
1 14
...

correct output
*=====*===*==*...................

user output
True
False
True
False

Error:
Traceback (most recent call last):
  File "input/code.py", line 67, 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:

input
100 100 1000
10 1
4 7
1 4
1 9
...

correct output
...*====*........................

user output
True
False
True
False
True
...

Feedback: Incorrect length on line 1: expected 100, got 4