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

15845번 - Winning ICPC 다국어

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

문제

There are N teams (numbered from 1 to N) and M problems (numbered from 1 to M) in this year's ICPC. The j-th problem has Tj testcases. Surprisingly, every team submitted exactly one solution to every problem. The i-th team managed to solve Si,j testcases on the j-th problem.

A team solved a problem only if the team managed to solve ALL testcases on that problem. The winning team is the team with the most number of problems solved. If there are more than one team with the most number of problems solved, then the winning team is the team with the smallest index among those teams.

Determine the index of the winning team.

입력

The first line contains two integers: N M (1 ≤ N, M ≤ 100) in a line denoting the number of teams and the number of problems. The second line contains M integers: T1 T2 ... TM (0 ≤ Ti ≤ 100) in a line denoting the number of testcases. The next N following lines, each contains M integers; the j-th integer on the i-th line is Si,j (0 ≤ Si,j ≤ Tj) denoting the number of solved testcases by the i-th team for the j-th problem.

출력

The output contains the index of the winning team, in a line.

제한

예제 입력 1

3 2
10 20
0 19
10 0
9 19

예제 출력 1

2

예제 입력 2

3 2
10 20
0 20
10 0
9 19

예제 출력 2

1

예제 입력 3

1 1
1
0

예제 출력 3

1

힌트

Explanation for the 1st sample case

On the first sample, the first and the third team did not solve any problem, and the second team solved the first problem. Therefore, the second team is the winner.

Explanation for the 2nd sample case

On the second sample, the first team solved the second problem, the second team solved the first problem, and the third team did not solve any problem. Since the first team has a smaller index than the second team, the first team is the winner.

Explanation for the 3rd sample case

On the third sample, there is only one team thus the winner is obvious.

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > ACM-ICPC Regional Contest, Jakarta 2017 A번

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

출처

대학교 대회

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

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