QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#3624. ASCII 艺术

统计

在平面上有 $n$ 个整点,你的任务是使用 ASCII 艺术技术在坐标系中绘制它们。

需要将每个给定的点在图像中表示为字符 'x' (ASCII 120)。如果坐标系的原点不在给定的点集中,则需要用字符 'o' (ASCII 111) 表示原点。此外,还需要用特殊字符表示坐标轴上没有给定点的位置。具体来说,x 轴上的此类位置应表示为 '-' (ASCII 45),y 轴上的此类位置应表示为 '|' (ASCII 124)。平面上既没有给定点、也不是原点或坐标轴的其余部分,应表示为空格 ' ' (ASCII 32)。

此外,整个图像必须放置在一个面积最小的矩形框内,该框的边界应由字符 '#' (ASCII 35) 标记。当然,所有给定的点以及原点都必须位于该框内。

请注意,上述要求唯一地确定了图像的外观。

输入格式

第一行包含一个自然数 $n$ ($1 \le n \le 5\,000$)。

接下来的 $n$ 行中,第 $i$ 行包含两个整数 $x_i$ 和 $y_i$ ($-500 \le x_i, y_i \le 500$),表示第 $i$ 个点的坐标。输入中每个点最多出现一次。

输出格式

输出坐标系的 ASCII 艺术图像,其中包含按题目描述标记的点。

样例

输入 1

2
1 1
-3 -1

输出 1

#######
#  |x#
#---o-#
#x  | #
#######

输入 2

6
-5 0
-3 0
-1 0
1 0
3 0
5 0

输出 2

#############
#x-x-xox-x-x#
#############

输入 3

20
-1 1
-1 2
-1 3
-2 2
-2 4
-3 2
-3 4
-4 1
-4 2
-4 3
1 -1
1 -2
1 -3
1 -4
2 -1
2 -4
3 -1
3 -4
4 -1
4 -4

输出 3

###########
# xx |  #
#x  x|  #
#xxxx|  #
#x  x|  #
#----o----#
#    |xxxx#
#    |x  #
#    |x  #
#    |xxxx#
###########

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.