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

Sirologija

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

의견: 0

설명

Croatian Olympiad in Informatics
April \(28^{st}\) 2024
You are an ant, but not just any ant – you’re an ant obsessed with cheeseology!
You’ve discovered a new slice of cheese in the kitchen and want to send as many of your minions as
possible to explore it. Imagine the cheese as a table with \(N\) rows and \(M\) columns, where the rows are
labeled from 1 to \(N\) from top to bottom, and the columns are labeled from 1 to \(M\) from left to right.
Some fields contain holes, while others contain cheese. We will denote the field in the \(r-th\) row and \(s-th\)
column as (r, s). The t\(op-le\)ft and bott\(om-ri\)ght fields will definitely contain cheese.
Let’s denote the number of minions as \(K\). Your minions will start their exploration in the t\(op-le\)ft field
and finish in the bott\(om-ri\)ght field. They can only move downwards and to the right. Additionally, their
paths must not "cross", meaning we can assign labels from 1 to \(K\) to them in such a way that there is no
field from which a minion with a lower label exited to the right, and a minion with a higher label exited
downwards.
Moreover, you would like these paths to be "different" in some sense, meaning that for every two minions,
there exists a field (r, s) containing a hole, such that one of them was at some point in column \(s\) and in a
row labeled lower than \(r\), while the other was at some point (not necessarily simultaneously) in column \(s\)
and in a row labeled higher than \(r\). Informally, every pair of minions approached some hole from different
sides.
Output the maximum value of \(K\) such that there exists a selection of minion paths satisfying the given
conditions.
Some examples of paths that do not satisfy the conditions:
(a) Invalid choice of pat\(hs - th\)ey intersect
(b) Invalid choice of pat\(hs - th\)ey approach a hole from
the same side

제약

In all subtasks, \(2 \le N\), \(M \le 2000\).
Subtask
Score
Constraints
1
15
All holes are in the same row.
2
18
N, \(M \le 10\)
3
16
N, \(M \le 50\), there are no holes in the first or last row or in the first or last column.
4
18
N, \(M \le 50\)
5
16
N, \(M \le 2000\), there are no holes in the first or last row or in the first or last column.
6
17
No additional constraints.

입력 형식

The first line contains positive integers \(N\), \(M\).
The next \(N\) lines contain descriptions of the table rows. The \(i-th\) line contains \(M\) characters, where .
denotes cheese and # denotes a field containing a hole.
Croatian Olympiad in Informatics
April \(28^{st}\) 2024

출력 형식

Output the maximum possible value of the number \(K\) in a single line.

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

Explanation of the first and second example:
(a) Example of paths for the first sample
(b) Example of paths for the second sample

문제 정보

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

출처 COCI 2023/2024 Olympiad

평가 및 의견

Sirologija

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

Log in to rate problems.

개별 의견

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

풀이 제출

Sirologija

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