Submission details
Task:Monikulmio
Sender:rene
Submission time:2025-11-01 13:39:53 +0200
Language:Python3 (PyPy3)
Status:READY
Result:44
Feedback
groupverdictscore
#144
Test results
testverdicttimescore
#1ACCEPTED0.04 s10details
#2ACCEPTED0.05 s10details
#30.05 s0details
#40.06 s0details
#50.05 s0details
#6ACCEPTED0.04 s7details
#70.09 s0details
#8ACCEPTED0.08 s10details
#9ACCEPTED0.09 s7details
#100.12 s0details

Code

first = input()

first = first.split(" ")
rows = int(first[0])
cols = int(first[1])
points = int(first[2])

matrix = [[0 for _ in range(cols)] for i in range(rows)]
points_list = []

for i in range(points):
  point = input()
  point = point.split(" ")
  x = int(point[0])
  y = int(point[1])
  matrix[x-1][y-1] = 1
  points_list.append((x-1, y-1))

# figure out connecting lines
for i in range(len(points_list)):
  next = (i + 1) % len(points_list)
  if next <= len(points_list):
    next = next
  else:
    next = 0
  x1, y1 = points_list[i]
  x2, y2 = points_list[next]

  # horizontal
  if x1 == x2:
    if y1 < y2:
      temp = y1+1
      while temp < y2:
        matrix[x1][temp] = 2
        temp += 1
    else:
      temp = y1-1
      while temp > y2:
        matrix[x1][temp] = 2
        temp -= 1
  #vertical
  elif y1 == y2:
    if x1 < x2:
      temp = x1+1
      while temp < x2:
        matrix[temp][y1] = 3
        temp += 1
    else:
      temp = x1-1
      while temp > x2:
        matrix[temp][y1] = 3
        temp -= 1
  # diagonals
  else:
    if (x1-x2) > 0 and (y1-y2) > 0:
      for d in range(1, x1-x2+1):
        matrix[x1-d][y1-d] = 5
    elif (x1-x2) > 0 and (y1-y2) < 0:
      for d in range(1, x1-x2+1):
        matrix[x1-d][y1+d] = 5
    elif (x1-x2) < 0 and (y1-y2) > 0:
      for d in range(1, y1-y2+1):
        matrix[x1+d][y1-d] = 4
    else:
      for d in range(1, y2-y1+1):
        matrix[x1+d][y1+d] = 4

for i in range(points):
  x, y = points_list[i]
  matrix[x][y] = 1

centerx= sum(x for x, y in points_list) // len(points_list)
centery= sum(y for x, y in points_list) // len(points_list)

stack = [(centerx, centery)]

while stack:
  x, y = stack.pop()
  if matrix[x][y] == 0:
    matrix[x][y] = 6
    if x > 0:
      stack.append((x-1, y))
    if x < rows-1:
      stack.append((x+1, y))
    if y > 0:
      stack.append((x, y-1))
    if y < cols-1:
      stack.append((x, y+1))

for i in range(rows):
  for j in range(cols):
    if matrix[i][j] == 0:
      print(".", end="")
    elif matrix[i][j] == 1:
      print("*", end="")
    elif matrix[i][j] == 2:
      print("=", end="")
    elif matrix[i][j] == 3:
      print("|", end="")
    elif matrix[i][j] == 4:
      print("\\", end="")
    elif matrix[i][j] == 5:
      print("/", end="")
    elif matrix[i][j] == 6:
      print("#", end="")
  print()

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
.................................

Feedback: Incorrect character on row 4, col 29: expected '/', got '\'

Test 4 (public)

Verdict:

input
20 40 14
5 12
5 25
8 28
13 28
...

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

user output
##############################...

Feedback: Incorrect character on row 4, col 27: expected '\', got '/'

Test 5 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 4, col 19: 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 3, col 3: expected '#', got '.'

Test 7 (public)

Verdict:

input
30 100 69
6 10
6 14
7 14
7 18
...

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

user output
##############################...

Feedback: Incorrect character on row 10, 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
.................................

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

Test 10 (public)

Verdict:

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

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

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

Feedback: Incorrect character on row 2, col 5: expected '\', got '/'