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

20747번 - Fishing Contest 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB21000.000%

문제

In a fishing contest, the participants fish in a lake, represented as a 2D grid of dimension $r \times c$. Each integer point in the grid contains fish.

At point $(x, y),ドル fish first appear at second $t_{x, y}$ and disappear just before time $t_{x, y} + k$ seconds. Outside of this time, no fish can be caught at this position. It takes no time to catch all the fish at a point, and all points contain the same amount of fish. Furthermore, moving to the point immediately north, west, south or east from the point you are currently at takes exactly 1ドル$ second.

Assume that you start at some position $(x_0, y_0)$ at second 1ドル,ドル and can catch fish until (and including) second $l$. From how many points in the lake can you catch fish, if you travel optimally on the lake?

입력

The input consists of:

  • one line with the integers $r,ドル $c,ドル $k$ and $l$ (1ドル \le r, c \le 100,ドル 1ドル \le k \le 5,ドル 1ドル \le l \le 10^5$), the dimensions of the lake, the number of seconds fish stays at a point, and the number of seconds you can catch fish.
  • one line with the integers $x_0$ and $y_0$ (0ドル \le r < x_0,ドル 0ドル \le c < y_0$), your original position.
  • $r$ lines, the $x$'th of which contains $c$ integers $t_{x, 0}, \dots, t_{x, c - 1}$ (each between 1ドル$ and $l,ドル inclusive), the times at which fish appers on points in the $x$'th row.

출력

Output the maximum number of points you could catch fish from.

제한

예제 입력 1

2 2 1 10
0 0
1 4
3 2

예제 출력 1

2

예제 입력 2

2 3 5 6
1 1
1 1 6
1 2 2

예제 출력 2

5

예제 입력 3

2 3 5 7
1 1
1 1 6
1 2 2

예제 출력 3

6

힌트

출처

Contest > Swedish Coding Cup > LTH Challenge 2017 F번

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

출처

대학교 대회

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

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