-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10295.cpp
More file actions
40 lines (40 loc) · 858 Bytes
/
Copy path10295.cpp
File metadata and controls
40 lines (40 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sz(a) int((a).size())
#define sza(a) (int)(sizeof(a)/sizeof((a)[0]))
#define all(c) (c).begin(),(c).end()
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define clr(x) memset(x,0,sizeof x)
#define pb push_back
#define fi first
#define sec second
typedef vector<int> vi;
typedef long long ll;
const int MX = 10e8 + 1;
int ct[500], qq[10001];
void Solution() {
int x, y, z;
cin >> x >> y;
string tmp;
map<string, int> mp;
long long ct = 0;
rep(i,0,x)
cin >> tmp >> z, mp[tmp] = z;
while (cin >> tmp) {
ct += mp[tmp];
if (tmp == ".") {
cout << ct << endl;
ct = 0;
}
}
}
int main() {
FastIO;
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin);
// freopen("output.in", "w", stdout);
#endif
Solution();
return 0;
}