Solution streak

Solution streak

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 1.0 s

Memory Limit: 32.0 MB

Description

A website named forcedToCode has a nice feature for the programmers who practices coding in this website. It showes the heatmap of an user in a 7 * n grid. Each cell of the grid represents the solution submission history of a day. If a cell is white that means this user has not submitted any solution on this day and if it is green that means he has at least one submission on this day. The green colour becomes deeper the more an user hits submission in a day. here are two examples of heatmaps

The count of days starts from the topmost cell of the first column (leftmost column is the first column) and it moves downwords each day until the last row then again starts from the top cell of the next column.

Nayon and Mahfuz are two friends from 60th batch. One day they were flexing on each other for having the biggest solution streak on ForcedToCode. Both of them thinks he has the maximum solution streak. Both of their solution streak is so high that it is very difficult to count the maximum solution streak from the heat map by counting. So they went to their friend Emon to write a program which will tell them who has the maximum solution streak. Can you write the same code that can find the maximum streak ?

Maximum streak is the number of longest consecutive days where an user has uploaded at least one submission a day.

Input

first line will take input of two integer M & N: number of columns in mahfuzs heatmap and number of columns in nayons heatmap.
after that you have to take input of 14 lines.
first 7 line of M integers will describe the heatmap of mahfuz
last 7 line of N integers will describe the heatmap of nayon

(the values in each cell will not exceed 100)
each number represents the submissions made by the user in a day. streak breaks when a 0 is found
1 <= M,N <=100

Output

You have to output one single line describing the winner who has the maximum streak :
either "Mahfuz is the boss" or "Nayon is the boss" (whthout quotation)

in terms of a tie in maximum solution streak who have the most number of solutions in his maximum streak will be the boss. if the maximum solution streak and most number of solutions are both equal print
"No one is the boss"

Note: please do not put a newline after printing the solution.
for examples,
in python : print("your answer",end="")
in c : printf("your answer");
in c++ : cout<<"your answer";

Sample 1

Input

4 5
1 2 1 0
0 1 2 1
1 1 1 0
3 2 0 0
2 1 1 1
1 3 1 2
5 1 0 4
2 1 3 1 1
1 0 1 2 0
0 3 5 3 0
1 0 1 4 0
0 1 1 2 0
3 4 1 0 0
4 1 2 3 0

Output

Nayon is the boss

Mahfujs longest streak started from the day 3 to day 17 of 15 days. in this longest streak he has solved a total of 1+3+2+1+5+2+1+1+2+1+3+1+1+2+1 = 27 problems.
Nayons longest streak started from the day 12 to 26 of 15 days. in this longest streak he has solved a total of 1+4+1+3+1+5+1+1+1+2+1+2+3+4+2 = 32 problems
so despite their maximum streaks are equal but Nayon wins for having the max number of problems solved in his maximum streak.

sample 2

input

3 2
0 0 0
0 0 0
3 0 0
0 0 4
0 0 0
0 0 0
0 0 0
0 0
0 1
0 0
0 4
0 0
0 0
0 0

output

No one is the boss

in this case both have a maximum streak of 1 day and same number of solution in their maximum streak. thats why no one is the boss

Brain booster - 1

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
10
Start at
2023-12-31 13:15
End at
2023-12-31 17:15
Duration
4.0 hour(s)
Host
Partic.
36