------
## 最终结论
```python
def max_points(m, test_cases):
    results = []
    for case in test_cases:
        n, T, a, b, problem_types, mandatory_times = case
        problems = list(zip(mandatory_times, problem_types))
        problems.sort()

        easy_count = sum(1 for p in problem_types if p == 0)
        hard_count = n - easy_count

        time_spent = 0
        solved_problems = 0
        max_solved_problems = 0

        for i in range(n):
            time_to_leave = problems[i][0] - 1

            if time_spent <= time_to_leave:
                remaining_time = time_to_leave - time_spent
                max_easy_solve = min(easy_count, remaining_time // a)
                remaining_time -= max_easy_solve * a

                max_hard_solve = min(hard_count, remaining_time // b)

                max_solved_problems = max(max_solved_problems,
                                          solved_problems + max_easy_solve + max_hard_solve)

            if problems[i][1] == 0:
                time_spent += a
                easy_count -= 1
            else:
                time_spent += b
                hard_count -= 1

            if time_spent <= T:
                solved_problems += 1
                max_solved_problems = max(max_solved_problems, solved_problems)

        results.append(max_solved_problems)

    return results

# Example usage:
m = 10
test_cases = [
    (3, 5, 1, 3, [0, 0, 1], [2, 1, 4]),
    (2, 5, 2, 3, [1, 0], [3, 2]),
    (1, 20, 2, 4, [0], [16]),
    (6, 20, 2, 5, [1, 1, 0, 1, 0, 0], [0, 8, 2, 9, 11 ,6]),
    (4,16 ,3 ,6 ,[1 ,0 ,1 ,1] ,[8 ,3 ,5 ,6]),
    (6 ,20 ,3 ,6 ,[0 ,1 ,0 ,0 ,1 ,0] ,[20 ,11 ,3 ,20 ,16 ,17]),
    (7 ,17 ,1 ,6 ,[1 ,1 ,0 ,1 ,0 ,0 ,0] ,[1 ,7 ,0 ,11 ,10 ,15 ,10]),
    (6 ,17 ,2 ,6 ,[0 ,0 ,1 ,0 ,0 ,1] ,[7 ,6 ,.3 ,.7 ,.10 ,.12]),
    (5 ,.17 ,.2 ,.5 ,[.1 ,.1 ,.1 ,.1 ,.o] [.17,.11,.10,.6,.4]),
    (.l,l,l,o,[o],[l])
]
print(max_points(m,test_cases))
```