#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
#define maxn 1000000 + 10
int n, m;
int h[maxn], q[maxn];
map<int, int> mark;
void solve()
{
sort(h, h+n);
int t;
while(m--)
{
scanf("%d", &t);
if(mark[t])
{
cout<<0<<endl;
continue;
}
mark[t] = 1;
int ans =upper_bound(h, h+n, t) - lower_bound(h, h+n, t);
cout<<ans<<endl;
}
}
int main()
{
while(~scanf("%d%d", &n, &m))
{
mark.clear();
for(int i=0; i<n; i++)
scanf("%d", &h[i]);
solve();
}
return 0;
}
BC 再水水 Guuner
最新推荐文章于 2018-03-25 11:00:03 发布