Help me in solving Contraints in problems like this?

My issue

I was wonder , how to use this constrains ?
1 ≤ Ai ≤ 109
Subtask 1 (35 points): T = 10, 1 ≤ N ≤ 1000
Subtask 2 (65 points): T = 10, 1 ≤ N ≤ 105

My code

# cook your dish here
T = int(input())   
for i in range(T):
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    chef_total = 0 
    for i in range(0,N,2):
        chef_total +=A[i]
    print(chef_total)

Learning course: Sorting using Python
Problem Link: CodeChef: Practical coding for everyone