Problem:


Score: 200 points

Problem Statement

We have N cards. A number a_i is written on the i-th card.

Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.

The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.

Constraints

N is an integer between 1 and 100 (inclusive).

a_i \ (1 \leq i \leq N) is an integer between 1 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:  

N
a_1 a_2 a_3 ... a_N

Output

Print Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.

Sample Input 1

2
3 1

Sample Output 1

2

First, Alice will take the card with 3. Then, Bob will take the card with 1.
The difference of their scores will be 3 - 1 = 2.

Sample Input 2

3
2 7 4

Sample Output 2

5

First, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.

Sample Input 3

4
20 18 2 18

Sample Output 3

18



Sample input:
2
3 1


Sample output:
2

Submission status: Accepted

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAEA9aV0C/+19fWAU1bX47OaD5SsbEDACStCoRCRkSYCsYMkHCzOwgUgCUvwYls2GpG6ycXc2BBUEk1THZSu1tqV9tvrr1/NnX19tf7ZFajGAEJQWQVBRFBABdw1IAIUAwv7OuffOZmZ2J0Lb9/5yldw9Z84995xzzz333Duzdx51OGeYTSZO+Zi5b3EIrR5RTOBihl8ViJMArojrC39HcSO5dIDTVHTFXLGm7GasldLC6FLgXyr8KzJTuMhcrClHMjqlNKnKNE79KdaULyzhNCXHZcfroaz76il2X/1iTWlJpfjMPtp6Zlavm9XrZvRKyZk5Tanol8r+VTF8FdNLKaczuukqevxUHJWq8fv2eyi8/Z5iTfkso3tWV+8uqJfOXfknk5XzWHtGdhnD5FdKpR/Ge+uWTCoc760e561rCDaPay6aNG5SYV7AlzeByJTJaGfOma+xYxaTeQjzAby+75rCQ4XL6ywH9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CewYqVEqFbvCqRLQ97kF6jcTqgE+shdkfjIcPOfm8SQcuhlWW1tGR6qNOp4S8JL4HMRB063FUdNEqHJaOyklixezKAtGrD5D1nvp6X5NH75xopZ6eSaJdvesBj1jrcf1zEYMFDBZ7ew8BSwIBlXP5JtZ4g4HaRDfBXCIfA0aza0ldkw3HfKAORzRUx4gLZqvxQfdBjZJSQbTlFejGIC5OkoYfr9fnhm4UVebQMIEAM0EUyfNtrG/w0TIMqf+ibeao+8BIvBq/x1A0sRFsCqse8QHPchaLk0bOxMgDbuGub0wSslgYBKMldcCJbq/HBSs+CfI6AQwL/yRoVRcOPb4avcujKsQBtBqQHIjEiavIJ8iiUz9BksMbEtxcm6jAeDFgnCxHmazOUYiXNBmFJPDGSswdpOUQQxuhKZ/ftdTjSNafSyDGNsAcJLlrdaYgTweCPzU3i40ef8AH/lYHDJvyE536KmcriHDoE6TH5kIiUe+r9iSZqpNox+bchGA8v2EZBux5HljJIquyMsDns7wKx5PXk2S6A6tOZnEgSbpX0BiUHO4kQoCvlUOm6noAoiosqJK4cuPynp63FWrT5cScAZMljsbe/w+MwsnR/5wAAA=='
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
def main2():
    stdin = open('/dev/stdin')
    stdin.readline()
    a = [x for x in map(int, stdin.readline().split())]
    a.sort()
    print(abs(sum(a[::2]) - sum(a[1::2])))
'''

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

A = sorted(A, reverse=True)
Alice = 0
Bob = 0
for n in range(N):
    if n % 2 == 0:
        Alice += A[n]
    else:
        Bob += A[n]

print(Alice - Bob)

Submission status: Accepted

Solution code:
num = int(input())

alice = 0
bob = 0
cards = list(map(int,input().split()))
for i in range(1,num+1):
    
    if i % 2 == 1:
        alice += max(cards)
        cards.remove(max(cards))
    else:
        bob += max(cards)
        cards.remove(max(cards))

ans = alice - bob
print(ans)