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

34749번 - A healthy menu 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB97867189.873%

문제

At the Institute of Creative Programming Competitions (ICPC), all students love fruits! Knowing this, management decided to conduct a large survey about food preferences to help in preparing the annual menu. To make the survey more professional, they hired the company SBC Research Solutions™, an acronym for “Saladas Bem Científicas”, although some say the name is a tribute to a well-known computer science society...

SBC received the following mission: the school has $M$ classes and offers $N$ different types of fruit. In each class, for each fruit, the number of students who like that fruit was reported.

However, since SBC did not have access to individual student data, nor do they know how many students are in each class, they now need your help! Based only on the survey results (how many students like each fruit in each class), determine the smallest possible number of students the school can have, knowing that the following constraints are satisfied:

  • each class has at least one student;
  • each student belongs to a single class;
  • each student likes at least one fruit;
  • the same student can like several fruits.

입력

The first line of input contains two integers $N$ and $M$ (1ドル ≤ N, M ≤ 1000$), the number of fruits and the number of classes, respectively. Each of the following $N$ lines contains $M$ integers $G_{i,j},ドル indicating how many students in class $j$ like fruit $i$ (0ドル ≤ G_{i,j} ≤ 10^6$ for 1ドル ≤ i ≤ N$ and 1ドル ≤ j ≤ M$).

출력

Your program should print a single line, containing a single integer, the smallest possible number of students in the school, considering the given constraints.

제한

예제 입력 1

3 3
20 15 14
12 20 12
18 5 10

예제 출력 1

54

예제 입력 2

2 3
5 2 4
4 3 6

예제 출력 2

14

노트

출처

ICPC > Regionals > Latin America > Sub-Regional Brasil do ACM ICPC > Maratona SBC de Programação 2025 A번

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

출처

대학교 대회

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

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