How to pass biweekly task for 4 points (Find Three Consecutive Integers That Sum to a Given Number)?

My solution always exceeds the time limit (Submission Result: Time Limit Exceeded), but I don't know why.
When I ran the test, the runtime was about 790ms, which is not that much I think.

class Solution:
    def sumOfThree(self, num: int) -> List[int]:
        def gen(num):
            x, y, z, r = 1, 2, 3, 0
            for _ in range(num):
                if num == x+y+z:
                    yield [x, y, z]
                    break
                else:
                    x += 1
                    y += 1
                    z += 1
            else:
                yield []

        res = next(gen(num))
        return res
Comments (3)