/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 13ms 2.805 MiB
#2 Accepted 13ms 2.824 MiB
#3 Wrong Answer 13ms 2.895 MiB
#4 Wrong Answer 14ms 2.785 MiB
#5 Accepted 12ms 2.695 MiB
#6 Accepted 13ms 2.777 MiB
#7 Accepted 13ms 2.832 MiB
#8 Accepted 13ms 2.875 MiB
#9 Wrong Answer 13ms 2.828 MiB
#10 Accepted 13ms 2.918 MiB

Code

from itertools import groupby
M, N = map(int, input().split())


def heatmap_input(column):
    record = []
    heatmap = []

    for _ in range(7):
        query = list(map(int, input().split()))
        record.append(query)

    for i in range(column):
        for j in range(7):
            heatmap.append(record[j][i])

    return heatmap


def max_streak(heatmap):
    streak = []
    max_len = 0

    for key, group in groupby(heatmap, lambda x: x == 0):
        group = list(group)
        if not key:
            if len(group) > max_len:
                streak = group
                max_len = len(group)
            elif len(group) == max_len:
                if sum(group) > sum(streak):
                    streak = group

    return streak


mahfuj = max_streak(heatmap_input(M))
nayon = max_streak(heatmap_input(N))

if len(mahfuj) > len(nayon):
    print("Mahfuj is the boss", end="")
elif len(mahfuj) < len(nayon):
    print("Nayon is the boss", end="")
else:
    if sum(mahfuj) > sum(nayon):
        print("Mahfuj is the boss", end="")
    elif sum(mahfuj) < sum(nayon):
        print("Nayon is the boss", end="")
    else:
        print("No one is the boss", end="")

Information

Submit By
Type
Submission
Problem
P1017 Solution streak
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-02 07:50:39
Judged At
2024-01-02 07:50:39
Judged By
Score
70
Total Time
14ms
Peak Memory
2.918 MiB