Submission details
Task:Lukujono
Sender:Nyno
Submission time:2025-11-09 21:21:32 +0200
Language:text
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details

Code

from collections import deque


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

for i in range(k):
    y1, x1 = points[i]
    y2, x2 = points[(i + 1) % k]
    dy = (y2 > y1) - (y2 < y1)
    dx = (x2 > x1) - (x2 < x1)
    y, x = y1, x1
    while True:
        grid[y-1][x-1] = '*' if (y, x) in points else (
            '=' if dy == 0 else
            '|' if dx == 0 else
            '\\' if dy == dx else
            '/')
        if (y, x) == (y2, x2):
            break
        y += dy
        x += dx

def fill_outside(grid):
    q = deque()
    for i in range(n):
        if grid[i][0] == '#':
            q.append((i,0))
        if grid[i][m-1] == '#':
            q.append((i,m-1))
    for j in range(m):
        if grid[0][j] == '#':
            q.append((0,j))
        if grid[n-1][j] == '#':
            q.append((n-1,j))
    while q:
        y,x = q.popleft()
        if grid[y][x] != '#':
            continue
        grid[y][x] = '.'
        for ny, nx in [(y+1,x),(y-1,x),(y,x+1),(y,x-1)]:
            if 0 <= ny < n and 0 <= nx < m and grid[ny][nx] == '#':
                q.append((ny,nx))

fill_outside(grid)

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

Test details

Test 1 (public)

Verdict:

input
(empty)

correct output
(empty)

user output
from collections import deque


n, m, k = map(int, input().spl...

Feedback: Error: invalid command from