37 lines
698 B
C++
37 lines
698 B
C++
|
#include <iostream>
|
||
|
#include <unordered_map>
|
||
|
#include <cstdio>
|
||
|
#pragma GCC optimize("Ofast")
|
||
|
using namespace std;
|
||
|
|
||
|
int main(void) {
|
||
|
int size, minMile;
|
||
|
unordered_map<string, int> data;
|
||
|
scanf("%d%d", &size, &minMile);
|
||
|
// cout << size << ' ' << minMile << '\n';
|
||
|
|
||
|
char id_char[18];
|
||
|
string id;
|
||
|
int tmp;
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
scanf("%s%d", id_char, &tmp);
|
||
|
id = id_char;
|
||
|
data[id] += max(tmp, minMile);
|
||
|
}
|
||
|
|
||
|
int queries;
|
||
|
scanf("%d", &queries);
|
||
|
|
||
|
for (int i = 0; i < queries; i++) {
|
||
|
scanf("%s", id_char);
|
||
|
id = id_char;
|
||
|
if (data.find(id) == data.end()) {
|
||
|
printf("No Info\n");
|
||
|
} else {
|
||
|
printf("%d\n", data[id]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|