Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- #include <unordered_map>
- using namespace std;
- unordered_map<string, int> taxes;
- int main() {
- int n, m;
- cin >> n >> m;
- string town;
- int tax;
- for(int i = 0; i < n; i++){
- cin >> town >> tax;
- taxes[town] = tax;
- }
- long long sum = 0;
- for(int i = 0; i < m; i++){
- cin >> town;
- sum += taxes[town];
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment