/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 34ms 17.387 MiB
#2 Accepted 34ms 17.289 MiB
#3 Accepted 35ms 17.258 MiB
#4 Accepted 35ms 17.281 MiB
#5 Wrong Answer 62ms 18.789 MiB
#6 Wrong Answer 60ms 18.742 MiB

Code

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ans = 0
    positive = 0
    for i in range(N):
        if A[i]>0:
            positive += 1
    for i in range(N):
        a = A.pop()
        if a<=0:
            break
        if i%2==0:
            ans += a
        else:
            ans -= a
            if positive>2:
                break
    print(ans)

Information

Submit By
Type
Submission
Problem
P1208 C. Game on Integer
Contest
Educational Round 1
Language
PyPy 3 (Python 3.9.18 PyPy 7.3.15)
Submit At
2025-07-14 16:01:29
Judged At
2025-07-14 16:01:29
Judged By
Score
5
Total Time
62ms
Peak Memory
18.789 MiB