Summer Institute '17 Contest 1 P10 - Trading Cards

View as PDF

Submit solution

Points: 3
Time limit: 1.4s
Memory limit: 256M

Problem type

Alice and Carl love collecting trading cards. They both have large collections, and want to know how much their collections are worth. Both of their collections consist of several types of cards, each with an associated value.

Input Specification

The first line of input consists of a single integer, n (1n200), the number of card types Alice has. The second line of input consists of n integers, a1 through an, where ai represents the value of Alice's ith card type (1ai100). The third line of input consists of n integers, b1 through bn, where bi represents how many cards of the ith type Alice has (1bi100). The fourth line of input consists of a single integer, m (1m200), the number of card types Carl has. The fifth line of input consists of m integers, c1 through cm, where ci represents the value of Carl's ith card type (1ci100). The sixth line of input consists of m integers, d1 through dm, where di represents how many cards of the ith type Carl has (1di100).

Output Specification

On a single line, output two space separated integers: the value of Alice's collection and the value of Carl's collection, respectively.

Sample Input 1

Copy
4
1 2 3 4
3 5 3 1
3
10 4 60
3 20 1

Sample Output 1

Copy
26 170

Comments


  • 0
    jeffreyqiu  commented on May 2, 2019, 7:53 p.m.

    friendly reminder to take in all of alice's info (cards and card values) before you start with carl's!


  • -2
    RohanDatta  commented on Jan. 12, 2019, 8:34 p.m.

    I'm getting ArrayIndexOutOfBounds error on Test Case 8 and 10, is there a way I can see what numbers were used for those cases?


    • -4
      injust  commented on Jan. 13, 2019, 6:32 a.m.

      You're getting your m's and n's mixed up.


    • -3
      Robloxian  commented on Jan. 12, 2019, 8:59 p.m.

      No