首页 > 其他 > 详细

BC 再水水 Guuner

时间:2015-04-06 14:15:32      阅读:235      评论:0      收藏:0      [点我收藏+]
#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

原文:http://blog.csdn.net/dojintian/article/details/44901465

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!