Problem: We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.  The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.  Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Submission attempts (in order):
def main(a: list, n: int, b: list):
    res = [[False, False, False], [False, False, False], [False, False, False]]
    for b in b:
        for i, a_row in enumerate(a):
            for j, a_col in enumerate(a_row):
                if b == a_col:
                    res[i][j] = True

    for i in range(3):
        # row
        if False not in res[i]:
            print("Yes")
            return

        # col
        if False not in [res[i][0], res[i][1], res[i][2]]:
            print("Yes")
            return

    # cross
    # ->
    if False not in [res[0][0], res[1][1], res[2][2]]:
        print("Yes c")
        return

    # <-
    if False not in [res[0][2], res[1][1], res[2][0]]:
        print("Yes c")
        return

    print("No")


if __name__ == "__main__":
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]

    main(a, n, b)


def main(a: list, n: int, b: list):
    res = [[False, False, False], [False, False, False], [False, False, False]]
    for b in b:
        for i, a_row in enumerate(a):
            for j, a_col in enumerate(a_row):
                if b == a_col:
                    res[i][j] = True

    for i in range(3):
        # row
        if False not in res[i]:
            print("Yes")
            return

        # col
        if False not in [res[0][i], res[1][i], res[2][i]]:
            print("Yes")
            return

    # cross
    # ->
    if False not in [res[0][0], res[1][1], res[2][2]]:
        print("Yes c")
        return

    # <-
    if False not in [res[0][2], res[1][1], res[2][0]]:
        print("Yes c")
        return

    print("No")


if __name__ == "__main__":
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]

    main(a, n, b)


def main(a: list, n: int, b: list):
    res = [[False, False, False], [False, False, False], [False, False, False]]
    for b in b:
        for i, a_row in enumerate(a):
            for j, a_col in enumerate(a_row):
                if b == a_col:
                    res[i][j] = True

    for i in range(3):
        # row
        if False not in res[i]:
            print("Yes")
            return

        # col
        if False not in [res[0][i], res[1][i], res[2][i]]:
            print("Yes")
            return

    # cross
    # ->
    if False not in [res[0][0], res[1][1], res[2][2]]:
        print("Yes")
        return

    # <-
    if False not in [res[0][2], res[1][1], res[2][0]]:
        print("Yes")
        return

    print("No")


if __name__ == "__main__":
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]

    main(a, n, b)


Verdicts: Wrong Answer

Wrong Answer

Accepted