#C6214. Taco Card Game Score Calculation
Taco Card Game Score Calculation
Taco Card Game Score Calculation
In this problem, two players, Emma and Olivia, are playing a card game. Each player has a deck of cards containing integer values. They draw cards simultaneously from the top of their decks and add them to their respective scores. The game stops once one of the players runs out of cards. Formally, if Emma has N cards and Olivia has M cards, then they play for k = \(\min(N, M)\) rounds, and the final scores are:
\(S_{Emma} = \sum_{i=1}^{k} Emma[i]\) and \(S_{Olivia} = \sum_{i=1}^{k} Olivia[i]\).
Your task is to compute the final scores for both players based on the given decks.
inputFormat
The input is read from stdin and consists of four lines:
- The first line contains an integer N, the number of cards in Emma's deck.
- The second line contains N space-separated integers representing the values of Emma's cards.
- The third line contains an integer M, the number of cards in Olivia's deck.
- The fourth line contains M space-separated integers representing the values of Olivia's cards.
outputFormat
Output to stdout two integers separated by a space, which are the final scores of Emma and Olivia, respectively.
## sample4
3 2 1 4
3
5 -1 2
6 6