시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 3 3 3 100.000%

문제

아스키 아트란, 아스키 코드에 포함되는 문자, 기호를 사용한 그림을 말한다. 이 문제에서는 이를 좀 더 단순화한 경우를 생각해 보기로 한다.

직사각형 형태의 격자가 있다. 왼쪽 아래 꼭지점의 좌표는 (0, 0)이고, 오른쪽 위 꼭지점의 좌표는 (w, h)이다. 각 픽셀이란 (x, y) - (x+1, y+1) 로 이루어지는 한 변의 길이가 1인 정사각형을 말한다. (물론 여기서 0<=x<w , 0<=y<h이다.)

이러한 직사각형 격자 위에 다각형이 그려져 있다. 볼록 다각형은 아니지만, 자기 자신과 교차하거나 만나지 않는 단순 다각형이다. 이러한 다각형을 그리면 각 픽셀은 적절한 부분만 다각형 내부에 포함되게 된다. 예를 들어 아래 그림을 보자.

이제 우리는 각 픽셀을 하나의 아스키 코드 문자로 표현할 것이다. 단순히, 다각형 내부에 포함되어 있는 부분의 비율로만 판단하여, 다음과 같이 각각의 아스키 코드로 표현하기로 한다.

  • 0%이상 25%미만 . (아스키 코드 번호 46)
  • 25%이상 50%미만 + (아스키 코드 번호 43)
  • 50%이상 75%미만 o (아스키 코드 번호 111)
  • 75%이상 100%미만 \$ (아스키 코드 번호 36)
  • 100% # (아스키 코드 번호 35)

문제에서 주어진 규칙에 따라 다각형의 아스키 아트를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 n, w, h가 빈 칸을 사이에 두고 주어진다. n은 다각형의 꼭지점의 개수이며 w와 h는 격자의 폭과 높이이다. 이어서 n개의 줄에는 다각형을 이루는 꼭지점이 시계방향으로 주어진다. 정수 좌표 xi와 yi로 주어진다. (0<=xi<=w, 0<=yi<=h) 주어지는 n, w, h는 모두 100 이하의 자연수이다.

출력

h개 줄에 걸쳐 아스키 아트를 표현하는 w개의 문자를 출력한다.

예제 입력 1

6 8 7
7 6
1 0
1 7
5 5
2 4
2 3

예제 출력 1

.$+.....
.##$+...
.#$oo+..
.#+$o...
.##o....
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wvPjxcL3A+XHJcbiIsImlucHV0IjoiPHA+VGhlIGZpcnN0IGxpbmUgb2YgdGhlIGlucHV0IGZpbGUgY29udGFpbnMgaW50ZWdlcnMgbiwgdywgYW5kIGggKDMgJmxlOyBuICZsZTsgMTAwLCAxICZsZTsgdywgaCAmbGU7IDEwMCkgJm1kYXNoOyBudW1iZXIgb2YgdmVydGljZXMgaW4gdGhlIHBvbHlnb24sIHdpZHRoIGFuZCBoZWlnaHQgb2YgdGhlIGNhbnZhcyByZXNwZWN0aXZlbHkuIFRoZSBmb2xsb3dpbmcgbiBsaW5lcyBjb250YWluIGNvb3JkaW5hdGVzIG9mIHRoZSBwb2x5Z29uIHZlcnRpY2VzIGluIGNsb2Nrd2lzZSBvcmRlci4gUG9pbnQgaSBpcyBkZXNjcmliZWQgYnkgdHdvIGludGVnZXJzIHg8c3ViPmk8XC9zdWI+IGFuZCB5PHN1Yj5pPFwvc3ViPiAoMCAmbGU7IHhpICZsZTsgdywgMCAmbGU7IHk8c3ViPmk8XC9zdWI+ICZsZTsgaCkuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+V3JpdGUgdG8gdGhlIG91dHB1dCBmaWxlIGggbGluZXMgd2l0aCB3IEFTQ0lJIGNoYXJhY3RlcnMgZWFjaCB0aGF0IHJlcHJlc2VudCBBU0NJSSBhcnQgZHJhd2luZyBvZiB0aGUgZ2l2ZW4gcG9seWdvbi48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > Europe > Northeastern European Regional Contest > NEERC 2006 A번

  • 문제의 오타를 찾은 사람: 7020kjs
  • 문제를 번역한 사람: author5