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

24287번 - Field 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB78312748.214%

문제

You are given a field which is a square table N x N filled with non-negative integers. Write a program field that calculates the minimum number M, such that all squares of size M x M that cover the whole number of cells in the field have their sum greater than or equal to K. The boundary of the square may lie on the boundary of the field.

입력

The first line of the standard input contains two integers separated by a space - N and K. The next N lines of the input contain N integers each, which represent the elements of the field.

출력

The program should send to the standard output one line, containing only one integer equal to the found minimum value of M or -1, if no such value exists.

제한

  • 1 ≤ N ≤ 5000
  • 0 ≤ each element in the field ≤ 50
  • 1 ≤ K ≤ 2⋅109

서브태스크

번호배점제한
15

N ≤ 20

210

N ≤ 100

320

N ≤ 500

435

N ≤ 2 000

530

N ≤ 5 000

예제 입력 1

5 10
1 2 3 4 5
10 0 7 0 4
0 0 2 1 3
5 0 3 0 2
0 5 0 8 0

예제 출력 1

3

힌트

For M=1 the 1x1 square:

2

has a sum of just 2 < 10.

For M=2 the 2x2 square:

0 7
0 2

has a sum of 9 < 10. For M=3 each 3x3 square has a sum ≥ 10.

Thus M=3 is the minimal M such that each square of size M x M has a sum of at least 10.

출처

Olympiad > International Autumn Tournament in Informatics > 2019 > Group B (Juniors) 6번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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