/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 24ms 4.398 MiB
#2 Accepted 22ms 3.84 MiB
#3 Accepted 21ms 4.051 MiB
#4 Accepted 22ms 3.902 MiB
#5 Accepted 22ms 3.926 MiB
#6 Accepted 21ms 3.82 MiB
#7 Accepted 22ms 3.883 MiB
#8 Accepted 22ms 4.027 MiB
#9 Accepted 22ms 4.094 MiB
#10 Accepted 22ms 4.09 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:44
Judged At
2024-01-11 18:42:44
Judged By
Score
100
Total Time
24ms
Peak Memory
4.398 MiB