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

24649번 - Letters Q and F 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB77333149.206%

문제

Little Lev is learning how to draw letters Q and F. Initially, he has a white grid of size $n \times m$. Then he will draw several letters of one of the following two shapes:

Lev will not rotate or mirror these two shapes. Every time he draws a new letter, he will choose a position for the letter inside the grid and paint all cells of the shape black. Lev will only draw letters in such a way that before drawing all black cells of the letter are white --- that is, he will never paint a cell twice.

You are given the final coloring of the grid. Count the number of letters Q and letters F drawn by Lev.

입력

The first line contains two integers $n$ and $m$ --- the height and the width of the grid (5ドル \le n \le 300$; 3ドル \le m \le 300$).

The next $n$ lines contain $m$ characters each, denoting the final state of the grid. A white cell is denoted by '.', a black cell is denoted by '\#'.

It is guaranteed that the grid is a valid result of Lev's drawing.

출력

Print two integers --- the number of letters Q and the number of letters F drawn by Lev, respectively.

제한

예제 입력 1

5 3
###
#.#
###
..#
..#

예제 출력 1

1 0

예제 입력 2

5 3
###
#..
##.
#..
#..

예제 출력 2

0 1

예제 입력 3

5 8
###..###
#.#..#..
###..##.
..#..#..
..#..#..

예제 출력 3

1 1

예제 입력 4

8 8
.....###
###..#.#
#.######
###.####
#.###.##
#.#.###.
..#...#.
......#.

예제 출력 4

2 2

힌트

Illustration for the fourth example test:

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2021-2022 North-Western Russia Regional Contest L번

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

출처

대학교 대회

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

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