QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 512 MB 總分: 100

#3624. ASCII Art

统计

Mr. Malnar is a passionate fan of art and urban culture in the city of Zagreb, so it is no surprise that he is a regular guest at the Art Park event held every year in Ribnjak Park. Interestingly, it was there that he found the inspiration for this task. While browsing the masterpieces of the "Cowboys, Guns, and Feminism" exhibition, he met a young girl.

Mr. Malnar: Have you noticed how contemporary artists rarely use the ASCII art technique? Girl: I must admit I am not familiar with that technique. What exactly is it? Mr. Malnar: It is a technique where artists display very complex images using the 128 characters defined by the ASCII standard. If you want, I can show you some of my work, and I could treat you to a hop juice while we're at it. Girl: Sounds interesting, sure!

There are $n$ integer points highlighted in a plane, and your task is to draw them in a coordinate system using the ASCII art technique.

Each of the highlighted points in the image must be represented by the character 'x' (ASCII 120). If the origin of the coordinate system is not among the highlighted points, it must be represented by the character 'o' (ASCII 111). Also, parts of the coordinate axes that do not contain highlighted points must be represented by special characters. More precisely, such parts of the $x$-axis must be represented by the character '-' (ASCII 45), and such parts of the $y$-axis must be represented by the character '|' (ASCII 124). The remaining parts of the plane that do not contain any highlighted point, the origin, or a coordinate axis must be represented by the space character ' ' (ASCII 32).

Additionally, the entire image must be placed in a rectangular frame of the smallest possible area, whose edge in the image must be marked with the characters '#' (ASCII 35). Of course, all highlighted points together with the origin must be located inside the frame.

Note that the specified requirements uniquely determine the appearance of the image.

Input

The first line contains a natural number $n$ ($1 \le n \le 5\,000$) from the problem text.

In the $i$-th of the next $n$ lines, there are two integers $x_i$ and $y_i$ ($-500 \le x_i, y_i \le 500$) representing the coordinates of the $i$-th highlighted point. Each point will appear in the input at most once.

Output

Print the ASCII art image of the coordinate system with the highlighted points as described in the problem text.

Examples

Input 1

2
1 1
-3 -1

Output 1

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

Input 2

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

Output 2

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

Input 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

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