Logo
(追記) (追記ここまで)

34448번 - Crazy Forks 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB94402132.812%

문제

John runs a shop selling antique silverware. He recently got some great publicity, and now lots of people are bringing in old collections of spoons, knives, and forks. He wants to sort the forks by size, shape, and type, but there are simply too many of them. John decides to use a camera and a computer program to label the forks automatically, but he isn't much of a programmer. John needs your crazy image-processing skills.

You helped Jon set up a camera which is reliably snapping a 50ドル \times 50$ black-and-white image of each fork. But John needs numerical measurements. Write some code to read in each image, and output the lengths of the handle and each of the tines.

입력

Every input is an image of some fork, drawn out with spaces ("") as white pixels and hashes ("#") as black pixels.

Each line of the input is a mix of $s$ (0ドル \leq s \leq 50$) white pixels and $h$ (1ドル \leq h \leq 50$) black pixels. These lines are the rows of our image.

Note: The lines may each be less than 50ドル$ characters long, since extra spaces at the end of the line have all been removed. There may also be fewer than 50ドル$ lines of input, since empty rows have all been removed.

Every input starts with $p$ (1ドル \leq p \leq 48$) rows showing the handle of the fork. This handle section has 0ドル$ or more white columns and then a black column.

After the end of the handle section, there is a single row of $w$ (3ドル \leq w \leq 50$) black pixels, with no white pixels between them.

The remaining $r$ (1ドル \leq r \leq 48$) rows show the tines of the fork. There are $t$ (2ドル \leq t < w$) tines, each a column of back pixels separated by columns of white pixels. The left-most column will always be a tine. Likewise, the rightmost tine aligns with the right side of the horizontal line above.

출력

The output consists of two lines. The first line prints the length in rows, $p,ドル of the handle.

The second line is a space delineated list of $t$ numbers, each in the range 1ドル \leq x \leq r$. Each number is the length of a tine in rows, with the numbers ordered left-to-right according to the tines' positions in the input.

제한

예제 입력 1

 #
 #
 #
######
# # #
# # #
# #
 #

예제 출력 1

3
3 4 2

예제 입력 2

 #
 #
 #
 #
##########
# # # #
# # #

예제 출력 2

4
2 2 2 1

노트

출처

School > CS@Mines > CS@Mines HSPC 2018 C번

  • 문제를 만든 사람: Sam Sartor
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /