码迷,mamicode.com
首页 > 其他好文 > 详细

BC 再水水 Guuner

时间:2015-04-06 14:16:36      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:acm   bc   

#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

标签:acm   bc   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!