#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n,q,i,j,k,l,m,t=0;
//freopen("uvain.txt","r",stdin);
//freopen("uvaout.txt","w",stdout);
while(cin>>n>>q)
{
vector<long long int>v;
v.clear();
t++;
if(n==0 && q==0)
{
break;
}
for(i=1;i<=n;i++)
{
cin>>k;
v.push_back(k);
}
sort(v.begin(),v.end());
printf("CASE# %lld:\n",t);
for(i=1;i<=q;i++)
{
cin>>l;
vector<long long int>::iterator low;
j=binary_search(v.begin(),v.end(),l);
if(j)
{
low=lower_bound(v.begin(),v.end(),l);
m=(low-v.begin());
printf("%lld found at %lld\n",l,m+1);
}
else
{
printf("%lld not found\n",l);
}
}
}
return 0;
}
0 comments:
Post a Comment