BUPT-homework/semester3/pset4/7-3-航空公司VIP客户查询.cpp
2022-10-30 20:57:06 +08:00

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;
}