Summer Institute '17 Contest 1 P10 - Trading Cards

View as PDF

Submit solution

Points: 4
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 Specifications

The first line of input consists of a single integer, n (1 \le n \le 200), the number of card types Alice has. The second line of input consists of n integers, a_1 through a_n, where a_i represents the value of Alice’s i^{\text{th}} card type (1 \le a_i \le 100). The third of input consists of n integers, b_1 through b_n, where b_i represents how many cards of the i^{\text{th}} type Alice has (1 \le b_i \le 100). The fourth line of input consists of a single integer, m (1 \le m \le 200), the number of card types Carl has. The fifth line of input consists of m integers, c_1 through c_m, where c_i represents the value of Carl’s i^{\text{th}} card type (1 \le c_i \le 100). The sixth of input consists of m integers, d_1 through d_m, where d_i represents how many cards of the i^{\text{th}} type Carl has (1 \le d_i \le 100).

Output Specifications

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

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

Sample Output 1

26 170

Comments


  • -11
    Narcariel  commented on Feb. 18, 2020, 11:12 a.m.

    This comment is hidden due to too much negative feedback. Click here to view it.


    • 2
      Plasmatic  commented on Feb. 18, 2020, 6:04 p.m.

      such brain much wow


      • 1
        hewmatt10  commented on Feb. 18, 2020, 7:54 p.m.

        very hard problem


        • -10
          Narcariel  commented on Feb. 19, 2020, 12:27 p.m.

          This comment is hidden due to too much negative feedback. Click here to view it.


          • -1
            Nathan13888  commented on March 30, 2020, 4:01 p.m.

            WOAH, THIS IS EVERYONE WHO ASKED! --> nobody ;''( sad


  • -1
    jeffreyqiu  commented on May 2, 2019, 3:53 p.m.

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


  • -1
    RohanDatta  commented on Jan. 12, 2019, 3: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?


    • -5
      injust  commented on Jan. 13, 2019, 1:32 a.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


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

      No