Submission details
Task:Monikulmio
Sender:Lelleri
Submission time:2025-10-27 12:22:42 +0200
Language:Python3 (PyPy3)
Status:READY
Result:76
Feedback
groupverdictscore
#1ACCEPTED76
Test results
testverdicttimescore
#1ACCEPTED0.04 s10details
#2ACCEPTED0.05 s10details
#3ACCEPTED0.05 s7details
#4ACCEPTED0.05 s7details
#5ACCEPTED0.05 s7details
#6ACCEPTED0.05 s7details
#7ACCEPTED0.08 s7details
#8ACCEPTED0.08 s7details
#9ACCEPTED0.09 s7details
#10ACCEPTED0.11 s7details

Code


def create_line(x1, y1, x2, y2, grid):
    steps = max(abs(x2-x1), abs(y2-y1))
    
    for step in range(1, steps):
        x_step = (0 if x2==x1 else (1 if x2>x1 else -1))
        y_step = (0 if y2==y1 else (1 if y2>y1 else -1))
        dx = x1 + x_step * step
        dy = y1 + y_step * step
        
        if(x_step == y_step and x_step == 1 or x_step == y_step and x_step == -1):
            grid[dy][dx] = chr(92)
        elif(x_step != y_step and x_step != 0 and y_step != 0):
            grid[dy][dx] = "/"
        elif(x_step == 0):
            grid[dy][dx] = "|"
        elif(y_step == 0):
            grid[dy][dx] = "="
        
    return grid
    
    

n, m, k = [int(i) for i in input().split()]


grid = [["." for _ in range(m)] for _ in range(n)]

points = []
for _ in range(k):
    y, x = input().split()
    points.append((int(x)-1, int(y)-1))
    
points.append((points[0][0], points[0][1]))

for i in range(1, len(points)):
    point1 = points[i-1]
    point2 = points[i]
    grid[point1[1]][point1[0]] = "*"
    grid = create_line(point1[0], point1[1], point2[0], point2[1], grid)


for row_i in range(n):
    inside = False
    for item_i in range(m):
        if grid[row_i][item_i] != "." and inside == False and sum([1 if item != "." else 0 for item in grid[row_i][item_i:]]) != 1:
            inside = True
        elif grid[row_i][item_i] != "." and inside:
            inside = False
        
        if inside and grid[row_i][item_i] == ".":
            print()
            grid[row_i][item_i] = "#"
        
for row in grid:
    for item in row:
        print(item, end="")
    print("\n", end="")

    





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 3, col 31: 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 16, col 26: 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 7, col 17: 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 2, col 25: 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 9, col 38: 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 4, col 25: 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 39: expected '.', got '#'