1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;++i) #define per(i,a,n) for(int i=n-1;i>=a;--i) #define fi first #define se second #define mp make_pair #define pb push_back #define np next_permutation #define cl(x,a,n) memset(x,a,sizeof(int)*n)
using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<int> vi; typedef pair<int,int> pii; typedef pair<string,string> pss; const int maxn=1e5+5;
int n,q; int cnt,a[maxn];
vector< pii > v; bool cmp( pii a, pii b){ if(a.se!=b.se) return a.se<b.se; else return a.fi<b.fi; } int main(){ ios::sync_with_stdio(false); while(cin>>n>>q && n+q){ rep(i,0,n){ cin>>a[i];
}
cout<<"CASE# "<<++cnt<<":"<<endl;
sort(a,a+n); rep(i,0,q){ int x; cin>>x; int index=lower_bound(a,a+n,x)-a; if(a[index]==x) cout<<x<<" found at "<<index+1<<endl; else cout<<x<<" not found"<<endl; }
}
}
|