Submission details
Task:Monikulmio
Sender:mr_mirror5
Submission time:2025-11-01 09:39:47 +0200
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.04 s0details
#20.04 s0details
#30.05 s0details
#40.04 s0details
#50.04 s0details
#60.04 s0details
#70.06 s0details
#80.06 s0details
#90.07 s0details
#100.11 s0details

Code

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

n, m, k = map(int, input().split())
points = [tuple(map(int, input().split())) for _ in range(k)]

points = [(y - 1, x - 1) for y, x in points]

grid = [['.' for _ in range(m)] for _ in range(n)]
print(points)
print(grid)
# Piiretään reunat 
for i in range(k):
    y1, x1 = points[i]
    y2, x2 = points[(i + 1) % k]
    dy, dx = sign(y2 - y1), sign(x2 - x1)
    y, x = y1, x1
    grid[y][x] = '*'
    while (y, x) != (y2, x2):
        y += dy
        x += dx
        if (y, x) == (y2, x2):
            grid[y][x] = '*'
        else:
            if dy == 0:
                grid[y][x] = '='
            elif dx == 0:
                grid[y][x] = '|'
            elif dy == dx:
                grid[y][x] = '\\'
            else:
                grid[y][x] = '/'


# Täytetään sisäosa
for y in range(n):
    
    crossings = sum(grid[y][x] in ('|', '/', '\\', '*') for x in range(m))

    #Jos vain yksi tähti    
    if crossings < 2:
        continue

    inside = False
    for x in range(m):
        if grid[y][x] in ('|', '/', '\\', '*'):
            inside = not inside
        elif inside and grid[y][x] == '.':
            grid[y][x] = '#'



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

Test details

Test 1 (public)

Verdict:

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

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

user output
[(4, 1), (1, 4), (4, 7), (6, 7...

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
[(4, 9), (4, 29), (14, 29), (1...

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
[(7, 6), (12, 1), (13, 1), (8,...

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
[(4, 11), (4, 24), (7, 27), (1...

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
[(2, 19), (6, 15), (6, 8), (10...

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
[(1, 2), (1, 7), (3, 7), (3, 4...

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
[(5, 9), (5, 13), (6, 13), (6,...

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
[(10, 2), (10, 4), (9, 5), (10...

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

Test 9 (public)

Verdict:

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

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

user output
[(0, 0), (0, 6), (0, 10), (0, ...

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

Test 10 (public)

Verdict:

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

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

user output
[(9, 0), (3, 6), (0, 3), (0, 8...

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