EJMAR21B - Editorial

PROBLEM LINK:

Practice

Author: Anuska Sinha
Tester: Akash Kumar Bhagat

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Math

PROBLEM:

A ‘Spaghetti & meatball’ eating competition is being held in Chefland. After the competition is over, you are given an M x N integer grid ‘bowls’ where M is the number of teams and N is the number of members in each team. bowls[M][N] denotes the number of bowls of ‘Spaghetti & meatball’ each member of a team had. You being the judge have to out which team ultimately won the competition by eating the maximum bowls of ‘Spaghetti & meatball’ and print only the maximum number of bowls of ‘Spaghetti and meatball’ eaten.

EXPLANATION:

We just have to find the sum of each row and find the greatest among them.

Example:
There are 3 teams A, B and C and have 3 members each.
The number of bowls of ‘Spaghetti and Meatball’ eaten by each team are [2,2,4],[1,3,3] and [5,4,5] respectively.

Team A: 2+2+4=8

Team B: 1+3+3=7

Team C: 5+4+5=14

As Team B had eaten the maximum bowls of ‘Spaghetti & meatball’, the output is 14.

SOLUTIONS:

Python
 for _ in range(int(input())):
    n,m=map(int,input().split())
    mx=-float('inf')
    for i in range(n):
        a=[int(i) for i in input().split()]
        mx=max(mx,sum(a))
    print(mx)

Solution by: Akash Kumar Bhagat