Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int N;
- int i;
- cin>>N;
- int array[N];
- for(i=0; i<N; i++)
- {
- cin>>array[i];
- }
- sort(array, array + N);
- int testN,test;
- cin>>testN;
- int found=0,position=0;
- for(i=0; i<testN; i++)
- {
- cin>>test;
- for(int j=0; j<N; j++)
- {
- if(array[j]==test)
- {
- found++;
- position++;
- }
- }
- if(found!=0)
- {
- cout<<"YES "<<position+1<<endl;
- }
- else
- cout<<"NO "<<position+1<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement