Created
August 3, 2016 15:35
-
-
Save libert-xyz/c9e835f51bdba1fc565c7c54fc8201ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #08/3/16 | |
| #https://www.hackerrank.com/challenges/collections-counter | |
| from collections import Counter | |
| n = int(raw_input()) | |
| l = map(int,raw_input().split()) | |
| c = int(raw_input()) | |
| s = 0 | |
| for i in range(c): | |
| p = map(int,raw_input().split()) | |
| index = 0 | |
| if Counter(l)[(p[0])] > 0: | |
| s = s + p[1] | |
| index = l.index(p[0]) | |
| l.pop(index) | |
| print s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment