/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 13ms 2.855 MiB
#2 Wrong Answer 13ms 2.887 MiB
#3 Wrong Answer 13ms 2.855 MiB
#4 Wrong Answer 14ms 2.715 MiB
#5 Wrong Answer 14ms 2.816 MiB
#6 Wrong Answer 13ms 2.836 MiB
#7 Wrong Answer 13ms 2.805 MiB
#8 Wrong Answer 13ms 2.785 MiB
#9 Wrong Answer 13ms 2.902 MiB
#10 Wrong Answer 13ms 2.914 MiB

Code

from itertools import groupby
M, N = map(int, input("Enter Number of Columns: ").split())


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

    for _ in range(7):
        query = list(map(int, input(f"Enter {name}'s Streaks in 7 Rows:\n").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 and len(group) > max_len:
            streak = group
            max_len = len(group)

    return streak


mahfuj = max_streak(heatmap_input(M, 'Mahfuj'))
nayon = max_streak(heatmap_input(N, 'Nayon'))

if sum(mahfuj) > sum(nayon):
    print("Mahfuj is the boss", end="")
elif sum(mahfuj) < sum(nayon):
    print("Nayon is the boss", end="")
else:
    if len(mahfuj) > len(nayon):
        print("Mahfuj is the boss", end="")
    elif len(mahfuj) < len(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 06:52:50
Judged At
2024-01-02 06:52:50
Judged By
Score
0
Total Time
14ms
Peak Memory
2.914 MiB