## Summer Institute '17 Contest 1 P10 - Trading Cards

View as PDF

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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, , the number of card types Alice has. The second line of input consists of integers, through , where represents the value of Alice's card type . The third of input consists of integers, through , where represents how many cards of the type Alice has . The fourth line of input consists of a single integer, , the number of card types Carl has. The fifth line of input consists of integers, through , where represents the value of Carl's card type . The sixth of input consists of integers, through , where represents how many cards of the type Carl has .

#### 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

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

#### Sample Output 1

26 170

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

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

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

such brain much wow

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

very hard problem

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

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

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

• 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!

• 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?

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

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

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

No