Submission details
Task:Monikulmio
Sender:PuskaJamal
Submission time:2025-10-27 22:59:11 +0200
Language:Python3 (PyPy3)
Status:READY
Result:72
Feedback
groupverdictscore
#172
Test results
testverdicttimescore
#1ACCEPTED0.04 s10details
#2ACCEPTED0.04 s10details
#30.07 s0details
#4ACCEPTED0.04 s7details
#5ACCEPTED0.04 s7details
#6ACCEPTED0.05 s10details
#7ACCEPTED0.06 s7details
#8ACCEPTED0.05 s7details
#9ACCEPTED0.05 s7details
#10ACCEPTED0.08 s7details

Code

# Koodi, joka toimii:
s = input()
s = s.split()
b = []
for i in range(int(s[0])):
    b.append("."*int(s[1]))
c = [0, 0]
for i in range(int(s[2])):
    d = input()
    e = d.split()
    e = [int(e[0]), int(e[1])]
    if c == [0, 0]:
        c = [int(e[0]), int(e[1])]
        u = c
    f = b[e[0]-1]
    f = f[: e[1]-1] + '*' + f[e[1]:]
    b[e[0]-1] = f
    if i != int(s[2]):
        if e != c:
            if e[0] == c[0]:
                if c[1]-e[1] < 0:
                    for i in range(e[1]-c[1]-1):
                        c = [c[0], c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '=' + f[c[1]:]
                        b[e[0]-1] = f
                    c = [c[0], c[1]+1]
                elif c[1]-e[1] > 0:
                    for i in range(c[1]-e[1]-1):
                        c = [c[0], c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '=' + f[c[1]:]
                        b[e[0]-1] = f
                    c = [c[0], c[1]-1]
            elif e[1] == c[1]:
                if c[0]-e[0] < 0:
                    for i in range(e[0]-c[0]-1):
                        c = [c[0]+1, c[1]]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '|' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]]
                elif c[0]-e[0] > 0:
                    for i in range(c[0]-e[0]-1):
                        c = [c[0]-1, c[1]]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '|' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]]
            elif e[0]-c[0] == e[1]-c[1]:
                if e[0]-c[0] > 0:
                    for i in range(e[0]-c[0]-1):
                        c = [c[0]+1, c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '\\' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]+1]
                elif e[0]-c[0] < 0:
                    for i in range(c[0]-e[0]-1):
                        c = [c[0]-1, c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '\\' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]-1]
            elif c[0]-e[0] == e[1]-c[1]:
                if e[0]-c[0] < 0:
                    for i in range(c[0]-e[0]-1):
                        c = [c[0]-1, c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '/' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]+1]
                elif e[0]-c[0] > 0:
                    for i in range(e[0]-c[0]-1):
                        c = [c[0]+1, c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '/' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]-1]
else:
    if u[0] == c[0]:
                if c[1]-u[1] < 0:
                    for i in range(u[1]-c[1]-1):
                        c = [c[0], c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '=' + f[c[1]:]
                        b[u[0]-1] = f
                    c = [c[0], c[1]+1]
                elif c[1]-u[1] > 0:
                    for i in range(c[1]-u[1]-1):
                        c = [c[0], c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '=' + f[c[1]:]
                        b[u[0]-1] = f
                    c = [c[0], c[1]-1]
    elif u[1] == c[1]:
                if c[0]-u[0] < 0:
                    for i in range(u[0]-c[0]-1):
                        c = [c[0]+1, c[1]]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '|' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]]
                elif c[0]-u[0] > 0:
                    for i in range(c[0]-u[0]-1):
                        c = [c[0]-1, c[1]]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '|' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]]
    elif u[0]-c[0] == u[1]-c[1]:
                if u[0]-c[0] > 0:
                    for i in range(u[0]-c[0]-1):
                        c = [c[0]+1, c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '\\' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]+1]
                elif u[0]-c[0] < 0:
                    for i in range(c[0]-u[0]-1):
                        c = [c[0]-1, c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '\\' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]-1]
    elif c[0]-u[0] == u[1]-c[1]:
                if u[0]-c[0] < 0:
                    for i in range(c[0]-u[0]-1):
                        c = [c[0]-1, c[1]+1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '/' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]-1, c[1]+1]
                elif u[0]-c[0] > 0:
                    for i in range(u[0]-c[0]-1):
                        c = [c[0]+1, c[1]-1]
                        f = b[c[0]-1]
                        f = f[: c[1]-1] + '/' + f[c[1]:]
                        b[c[0]-1] = f
                    c = [c[0]+1, c[1]-1]

# Oliko ymmärrettävä?


g=0


for i in range(len(b[len(b)//2])):
    if b[len(b)//2][i] != ".":
        if b[len(b)//2][i+1] == ".":
             g = i+1
             break



def j(b, v, l):
    if b[v+1][l]== ".":
        b[v+1] = b[v+1][: l] + '#' + b[v+1][l+1:]
        j(b, v+1, l)
    if b[v-1][l]== ".":
        b[v-1] = b[v-1][: l] + '#' + b[v-1][l+1:]
        j(b, v-1, l)
    if b[v][l+1]== ".":
        b[v] = b[v][: l+1] + '#' + b[v][l+2:]
        j(b, v, l+1)
    if b[v][l-1]== ".":
        b[v][: l-1] + '#' + b[v][l:]
        j(b, v, l-1)
          
     


j(b, len(b)//2, g)















for i in range(len(b)):
    print(b[i])

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:

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

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

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 173, in <module>
    j(b, len(b)//2, g)
  File "input/code.py", line 159, in j
    j(b, v+1, l)
  File "input/code.py", line 159, in j
    j(b, v+1, l)
  File "input/code.py", line 159, in j
    j(b, v+1, l)
  [Previous line repeated 6 more times]
  File "input/code.py", line 157, in j
    if b[v+1][l]== ".":
IndexError: list index out of range

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 17, col 15: 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 8, col 11: expected '#', got '.'

Test 6 (public)

Verdict: ACCEPTED

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

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

user output
.................................

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 9, col 8: 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 6, col 23: expected '#', got '.'

Test 9 (public)

Verdict: ACCEPTED

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

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

user output
*=====*===*==*...................

Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 11: expected '#', got '.'

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 6: expected '#', got '.'