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

Šuma

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

의견: 0

설명

\(2^{nd}\) round, November \(8^{th}\), 2014
Mirko lives in a big enchanted forest where trees are very tall and grow really quickly. That forest can be represented
as an \(N \cdot N\) matrix where each field contains one tree.
Mirko is very fond of the trees in the enchanted forest. He spent years observing them and for each tree measured
how many meters it grew in a year. The trees grow continuously. In other words, if the tree grows 5 meters
in a year, it will grow 2.5 meters in half a year.
Apart from trees, Mirko likes mushrooms from the enchanted forest.
Sometimes, he eats suspicious colorful
mushrooms and starts thinking about peculiar questions.
Yesterday, this unfortunate thing happened and he
wondered what would be the size of the largest connected group of trees that are all of equal height if the
trees continue to grow at the same speed they’re growing at that moment.
Mirko quickly measured the current height of all trees in the forest and asked you to answer his question.
Two trees are adjacent if their fields in the matrix share a common edge.
Two trees are connected if there is a sequence of adjacent trees that leads from the first to the second.
A group of trees is connected if every pair of trees in the group is connected.

제약

In test cases worth 30% of total points, it will hold 1 ⩽N ⩽70.

입력 형식

The first line of input contains the integer N (1 ⩽N ⩽700).
After the first line, N lines follow, each of them containing N integers.
The i^{th} line contains integers h_{ij} (1 ⩽h_{ij} ⩽\(10^{6}\)), the initial height of tree in the i^{th} row and j^{th} column, given in
meters.
After that, N more lines follow with N integers.
The i^{th} line contains integers v_{ij} (1 ⩽v_{ij} ⩽\(10^{6}\)), the growth speed of the tree in the i^{th} row and j^{th} column, given
in meters.
Warning: Please use faster input methods beacuse the amount of input is very large. (For example, use scanf
instead of cin in C++ or BufferedReader instead of Scanner in Java.)

출력 형식

The first and only line of output must contain the required number from the task.

예제 1
입력
3
1 2 3
3 2 2
5 2 1
3 2 1
1 2 1
1 2 3
2
3 1
3 3
2 5
2 5
출력
output
7
3
설명

Clarification of the second example: after 8 months (two thirds of a year), the trees located at (0, 0), (0, 1) and (1, 0)
will be 13/3 meters in height.

문제 정보

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

출처 COCI 2014/2015 Contest 2

평가 및 의견

Šuma

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

Log in to rate problems.

개별 의견

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

풀이 제출

Šuma

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