RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00573

Selotejp

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

For Mirko there is no greater happiness than finding a new roll of sticky tape, and
today he is especially happy because he had also found Slavko’s Advent calendar.
The Advent calendar can be represented as a table with \(n\) rows and \(m\) columns. Each
square contains a little window, and behind each window is a piece of chocolate. Slavko
had already opened some of the windows, and others are still closed.
Mirko decided to use his sticky tape to glue all closed windows shut. The tape is infinitely long, and
it is one calendar cell wide. Mirko can rip offa piece of tape and use it to glue some sequence of
horizontally or vertically adjacent closed windows shut. He doesn’t want to put more than one
piece of tape over some window, since he wants to remain friends with Slavko.
He is wondering what is the minimal number of pieces of tape he needs to glue all closed windows shut.

제약

Subtask 1 (35 points): Each closed window is adjacent to (shares a side with) at most two other closed windows.

Subtask 2 (35 points): \(1 \le n \le 10\)

Subtask 3 (40 points): No additional constraints.

입력 형식

The first line contains integers \(n\) and \(m\) (\(1 \le n \le 1000\), \(1 \le m \le 10\)), dimensions of the Advent calendar.
Each of the following \(n\) lines contains \(m\) characters ’.’ and ’#’ that represent the Advent calendar. The
character ’.’ denotes an open window, and the character ’#’ denotes a closed window.

출력 형식

Output the minimal number of pieces of tape needed to glue all closed windows shut.

서브태스크
서브태스크점수설명

1

35점

Each closed window is adjacent to (shares a side with) at most two other closed windows.

2

35점

\(1 \le n \le 10\)

3

40점

No additional constraints.

예제 1
입력
2 3
#.#
###
출력
3
예제 2
입력
4 3
.#.
###
.##
.#.
출력
3
예제 3
입력
4 4
####
#.#.
#.##
####
출력
5
설명

Clarification of the first example:
One possible solution is to use one piece of tape for the first column, one piece for the third column, and
one piece for the window in the second row and second column.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2020/2021 Contest 3

평가 및 의견

Selotejp

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Selotejp

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8