/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 30ms 4.895 MiB
#2 Accepted 30ms 4.617 MiB
#3 Accepted 30ms 4.734 MiB
#4 Accepted 31ms 4.734 MiB
#5 Accepted 30ms 4.586 MiB
#6 Accepted 30ms 4.754 MiB
#7 Accepted 30ms 4.637 MiB
#8 Accepted 29ms 4.676 MiB
#9 Accepted 31ms 4.727 MiB
#10 Accepted 31ms 4.723 MiB

Code

from typing import List, Tuple

def solve():
    m, n = map(int, input().split())
    mm = [list(map(int, input().split())) for _ in range(7)]
    nn = [list(map(int, input().split())) for _ in range(7)]

    m_sum, n_sum = 0, 0
    vectm, vectn = [], []
    m_cnt, n_cnt = 0, 0

    for i in range(m):
        for j in range(7):
            if mm[j][i] != 0:
                m_cnt += 1
                m_sum += mm[j][i]
            else:
                vectm.append((m_cnt, m_sum))
                m_cnt, m_sum = 0, 0
    vectm.append((m_cnt, m_sum))

    for i in range(n):
        for j in range(7):
            if nn[j][i] != 0:
                n_cnt += 1
                n_sum += nn[j][i]
            else:
                vectn.append((n_cnt, n_sum))
                n_cnt, n_sum = 0, 0
    vectn.append((n_cnt, n_sum))

    vectm.sort()
    vectn.sort()

    if vectm[-1][0] > vectn[-1][0]:
        print("Mahfuz is the boss")
    elif vectm[-1][0] < vectn[-1][0]:
        print("Nayon is the boss")
    else:
        if vectm[-1][1] > vectn[-1][1]:
            print("Mahfuz is the boss")
        elif vectm[-1][1] < vectn[-1][1]:
            print("Nayon is the boss")
        else:
            print("No one is the boss")

def main():
    fast = lambda: None
    # debug()

    TestCase = 1
    # TestCase = int(input())
    while TestCase:
        solve()
        TestCase -= 1

if __name__== "__main__":
    main()

Information

Submit By
Type
Submission
Problem
P1017 Solution streak
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-11 18:42:59
Judged At
2024-11-11 03:43:32
Judged By
Score
100
Total Time
31ms
Peak Memory
4.895 MiB