Submission details
Task:Monikulmio
Sender:MattiDragon
Submission time:2025-10-27 21:05:06 +0200
Language:Python3 (CPython3)
Status:READY
Result:79
Feedback
groupverdictscore
#1ACCEPTED79
Test results
testverdicttimescore
#1ACCEPTED0.02 s10details
#2ACCEPTED0.02 s10details
#3ACCEPTED0.02 s7details
#4ACCEPTED0.02 s7details
#5ACCEPTED0.02 s10details
#6ACCEPTED0.02 s7details
#7ACCEPTED0.02 s7details
#8ACCEPTED0.02 s7details
#9ACCEPTED0.02 s7details
#10ACCEPTED0.03 s7details

Code

def sign(x):
    if x > 0:
        return 1
    if x < 0:
        return -1
    return 0

height, width, cornerCount = (int(x) for x in input().split())
corners = [tuple(int(x) - 1 for x in input().split()) for _ in range(cornerCount)]

grid = [["#" for _ in range(width)] for _ in range(height)]

prev_y, prev_x = corners[-1]
for (y, x) in corners:
    dy = y - prev_y
    dx = x - prev_x
    char = "?"
    match (sign(dy), sign(dx)):
        case (1, 1) | (-1, -1):
            char = "\\"
        case (1, -1) | (-1, 1):
            char = "/"
        case (0, 1) | (0, -1):
            char = "="
        case (1, 0) | (-1, 0):
            char = "|"
    
    for t in range(1, max(abs(dy), abs(dx))):
        grid[prev_y + sign(dy) * t][prev_x + sign(dx) * t] = char
    
    grid[y][x] = "*"
    prev_y, prev_x = y, x


chars = ('#', '.')
for row in grid:
    for (i, cell) in enumerate(row):
        if cell in chars:
            row[i] = '.'
        else:
            break
    for (i, cell) in enumerate(reversed(row)):
        if cell in chars:
            row[-1 - i] = '.'
        else:
            break

for i in range(width):
    for row in grid:
        if row[i] in chars:
            row[i] = '.'
        else:
            break
    for row in reversed(grid):
        if row[i] in chars:
            row[i] = '.'
        else:
            break
        

for row in grid:
    print("".join(row))

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

Test 5 (public)

Verdict: ACCEPTED

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

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

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

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 5, col 6: 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 11, col 32: 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 27: 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 3, col 9: 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 9: expected '.', got '#'