#include<string>
#include<iostream>
#include<unordered_map>
using namespace std;
struct Node
{
string s;
};
hash<string> h;
struct hashcode
{
size_t operator () (const Node & r) const
{
size_t res=0;
for(int i=0;i<18;i++)
res=(res+(size_t)r.s[i]*r.s[i]*i*i*i)%3000007;
return res;
}
};
struct hashequal
{
bool operator () (const Node & a,const Node & b) const
{
return a.s==b.s;
}
};
unordered_map<Node,int,hashcode,hashequal,allocator< pair<const Node, int > > > a(500007);
int main()
{
ios::sync_with_stdio(false);
int n,k;
cin>>n>>k;
Node s;
int t;
while(n--)
{
cin>>s.s>>t;
a[s]+=(t>=k?t:k);
}
cin>>n;
while(n--)
{
cin>>s.s;
int res=a[s];
if(res==0) cout << "No Info" << endl;
else cout << res << endl;
}
return 0;
}
c++11::std::unordered_map::demo
最新推荐文章于 2024-04-11 09:00:00 发布